algorithm step by step procedures that adds numbers from 1 to 100
#include <iostream>
using namespace std;
int main()
{
//1) Declare variable of sum
double sum=0;
//2) Make a loop from 1 to 100
for (int i = 1; i <= 100; i++)
{
//3) Accumulte value of i in sum
sum += i;
}
//4)Output sum
cout << "Summ = " << sum;
}
Comments
Leave a comment