Answer to Question #331431 in C++ for florence

Question #331431

Write a program to count and print even values between 0 and 20:


Sample Output


The Total even numbers between 0 and 20 exclusives is 10

1
Expert's answer
2022-04-20T12:40:22-0400
#include <iostream>

using namespace std;

int main()
{
	int lower = 0;
	int upper = 20;
	int count = 0;
	for (int i = lower; i < upper; i++)
	{
		if (i % 2 == 0)count++;
	}
	cout << "Total even numbers between 0 and 20 exclusives is " << count;
}

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
APPROVED BY CLIENTS