Answer

We can rearrange the program so that it maintains a running sum. This way, we need only two variables: one to read the input and one to keep track of the running sum.

Return to lesson.



Hamlet Project
hamlet@cs.utah.edu