Algorithm 1

Carry out the following instructions.

  1. Draw a box, label the box A, write the number 1 in box A
  2. Draw a line that values may be written on, label the line Output
  3. If the number in box A is less than or equal to 5 then do the next instruction, otherwise do instruction 7
  4. Write the number in box A on the line labeled Output
  5. Replace the number in box A with the number that is one more than the number currently in box A
  6. Go back and do instruction 3 again
  7. You are done

What did this algorithm accomplish? (Describe the sequence of numbers on the Output line.)

Often in algorithm execution there are instructions that are executed repeatedly.

  • How many times was instruction 1 done?
  • How many times was instruction 4 done?
  • How many times was instruction 5 done?
  • How many times was instruction 6 done?
  • How many times was instruction 3 done?
  • How many times was instruction 7 done?