Declare a variable with value 0 above the for loop, add totals to this variable's value on each loop, and display the value of the variable as you do with totals after the for loop.