Adding n natural number and find the space required by the algorithm
Answers
Answered by
0
Answer:
int sum = 0;
// i initialise the sum variable to 0
for (int i=0;i<50;i++)
// here is a loop for counting till he get 50 start at 0 so he can attempt 49
{sum +=i;}
//each new number will add it to the older one
cout<<"SUM IS"<<sum<<endl;
//print the result
Similar questions