Work out the total of 1 up to n. The loop and the output are already written — only the line inside the loop is missing. n is 10, so the answer is 55.
55
#include <iostream>
using namespace std;
int main() {
int n = 10;
int total = 0;
for (int i = 1; i <= n; i++) {
// your code here: add this round's i into total
}
cout << total << endl;
return 0;
}
Run tries the examples. When they look right, Submit.