+ 2
Hi guys! Help me
How to write a c++ program. numbers decreasing from 100 to 5 by 5 and find the sum of all answers?Must be used while loop
1 Respuesta
+ 17
You mean like this..?
#include <iostream>
using namespace std;
int main()
{
int y = 0, x = 100;
while (x>=5) {
y += x; x -= 5;
}
cout << "Total sum = " << y << endl;
return 0;
}
i hope it can be helpfull...