Add every element into a running total, then print once.
Summing an array is a running total over indexes 0 through n-1. Start at 0, add each a[i], print once at the end.
sum
1
9
17
Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. 1+8+3+5 =
17.
2. sum starts at 0 so that:
Identity for addition.
3. The loop runs i from:
0 .. n-1.
4. Printing inside the loop would show:
Print after for the final total.
5. For a 2-D matrix sum you would:
Rows then columns.