How does the four-step loop-variable pattern — initialize, test, use, change — turn a `while` loop into a factorial machine?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The accumulator total = 0 and the loop variable i = 1 are given.
Use a while loop to add up the whole numbers 1, 2, 3, 4, 5, leaving the result in total. Follow the four-step pattern: initialize a loop variable, test it, use it, change it.