# Algorithm 7

Set-up instructions:

- Draw six adjacent boxes and number the boxes 0 though 5
- Put the following numbers in boxes 0 - 5, one number per box: 3 7 14 9 7 2

Carry out the following instructions using the values in the group of numbered boxes.

- Draw a line that values may be written on, label the line Output
- Draw a box, label the box I, write the number 0 in box I
- Draw a box, label the box S, write the number 0 in box S
- If the number in box I is less than 6 then do the next instruction, otherwise do instruction 8
- Replace the number in box S with the value currently in box S plus the number in the numbered box whose number is the same as the number in box I
- Replace the number in box I with the number that is one more than the number currently in box I
- Go back and do instruction 4 again
- Write the number in box S on the line labeled Output
- You are done

Describe the significance of the number on the Output line.

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

What would happen if the number 6 was replaced by 7 in instruction 4?