Answer to Question #320059 in C++ for Last three

Question #320059

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

1
Expert's answer
2022-03-29T07:41:23-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog