Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!