9.5. Le motif d'accumulateur

let n = 6;
let total = 0;

for (let i = 1; i <= n; i++) {
   total += i;
}

console.log(total);

/*The variable total is initialized to 0. The loop executes once each for
  the values of i from 1 to 6. Each time the loop body executes, the 
next value of i is added to total.*/
Tough Tortoise