Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The C++ program should ask the user an initial value and a terminal value which will serve as the range of numbers that will be

The C++ program should ask the user an initial value and a terminal value which will serve as the range of numbers that will be printed on the screen. The C++ program should also display only those numbers divisible by 5 in the given range. If the value of the initial value is greater than the terminal value, then the C++ program should display Invalid entry.

Fill in the blanks in the incomplete program:

#include

using namespace std;

int main() {

int initial, terminal;

cout << "Enter initial value:";

cin >> initial;

cout << "Enter terminal value:";

cin >> terminal;

if (______________) {

cout << "Numbers in the range divisible by 5: ";

do {

if (______________)

cout << initial << " ";

initial++;

} while (______________);

}

else

cout << "Invalid entry.";

return 0;

}

The output should be:

Enter initial value: 3

Enter terminal value: 47

Numbers in the range divisible by 5: 5 10 15 20 25 30 35 40 45

Enter initial value: 45

Enter terminal value: 8

Invalid entry.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions