Answer to Question #312882 in C++ for sarah

Question #312882

Using a while loop write a program to compute the sum of numbers between 20 and 25


1
Expert's answer
2022-03-17T06:42:26-0400
#include <iostream>

using namespace std;

int main()
{
	int i = 20;
	int sum = 0;
	while (i <= 25)
	{
		sum += i;
		i++;
	}
	cout << "Sum of numbers between 20 and 25 is " << sum;
}

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