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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started