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

Expert's answer

#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!

LATEST TUTORIALS
APPROVED BY CLIENTS