Input two integers in one line. The first inputted integer will be the starting point, and the second one shall serve as the ending point.
Use the power of loops to loop through the starting point until the ending point (inclusive), and print out each number within the range with the corresponding format shown on the sample output. However, skip the printing of statement if the integer is divisible by 4. Tip: Utilize the continue keyword to complete the process
#include <iostream>
using namespace std;
int main()
{
int firstPoint;
int secondPoint;
cout << "Enter start point: ";
cin >> firstPoint;
cout << "Enter end point: ";
cin >> secondPoint;
for (int i = firstPoint; i <= secondPoint; i++) {
if (i % 4 == 0) {
continue;
}
else
{
cout << i << endl;
}
}
return 0;
}
Comments
Leave a comment