Step 1 · Read and run
Adding up
A running total has three parts:
- Before the loop, make the total and set it to 0.
- Inside the loop, add to it:
total = total + number. - After the loop, print it.
This adds up 1 to 10. Press Step through to watch total grow: 1, 3, 6, 10, …
Run the program to carry on.