For Loop. Typical tasks




Task
Try changing the program from the previous example so that it finds the sum of numbers from -10 to b, where b is entered from the keyboard.
Use comments in the source code as a hint.
C++
1
#include<iostream>      
2
using namespace std;   
3
main()  {      
4
  int i, s, b;      
5
6
  s = 0;      
7
8
     s = s + i;      
9
cout << s;    
10
}      
Your last submission is saved in the editor window.
     

Results:

All results: