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:


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:\n";

do {

if (______________)

cout << initial << " ";


} while (______________);



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.

Public Answer

J1YVYZ The First Answerer