Exerpad
Exercise 9 · Chapter: While LoopsOptional+50 XP

Fix the Accumulator

This program should compute the sum of 1+2+3+4+5, but it starts wrong. Fix it!

Expected output:

15
Need a hint?
3 available · costs 5 XP each
javascript
let total = 1;
let i = 1;
while (i <= 5) {
total = total + i;
i = i + 1;
}
console.log(total);
Output
Run your code to see the output here.