Algorithm 6

Set-up instructions:

  1. Draw a line that values may be written on, label the line Input
  2. On the line labeled Input write the following numbers: 3 7 14 9 7 2

Carry out the following instructions using the values in the Input line.

  1. If there are no numbers on the Input line do the next instruction, otherwise do instruction 3
  2. You are done
  3. Draw a box, label the box S, write the number 0 in box S
  4. Draw a box, label the box X write the number 999 in box X
  5. Draw a line that values may be written on, label the line Output
  6. If there are still numbers on the line labeled Input then do the next instruction, otherwise do instruction 10
  7. Replace the number in box X with the the next number on the line labeled Input, erase from the Input line the number that was copied to box X
  8. Replace the number in box S with the sum of the number that is currently in box S plus the number in box X
  9. Go back and do instruction 6 again
  10. Write the number in box S on the line labeled Output
  11. You are done

Describe the significance of the number on the Output line.

Describe the value in box S after each execution of instruction 8.

How did the number 999 put initially in box X in instruction 4 affect the result?

What if there were different numbers on the Input line?