Using a while loop write a program to compute the sum of numbers between 20 and 25
#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;
}
Comments
Leave a comment