Task 6 of 7 · 0 solved · 7 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

2.3 Iteration — sum to n

Total: 0 / 4 pts
Practice mode — check each part and get hints as you go.
Task

Read a number n and print the sum 1 + 2 + ... + n. Use a while loop.

Input 5 gives 15. Input 0 gives 0.

Your solution