Flowcharts: Repeating Steps with Loops

Your teacher asks you to write out the 7 times table, from 7 × 1 to 7 × 12. That is twelve almost identical lines. Is there a way to write the step once and tell the computer to repeat it?

In this post:

  • What a loop (repetition) is and why it saves work
  • Counters: how a loop knows when to stop
  • Two flowcharts you can run: a times table and the average of five numbers
  • Tracing a loop, a quiz and your own loop flowchart

Loops: doing it again

A loop repeats a group of steps. Instead of drawing the same symbols twelve times, you draw them once and add an arrow that goes back up, so the steps run again. A decision checks each time whether to go round again or to leave the loop. Without that check, the loop would never end!

Many loops use a counter: a variable that counts how many times the loop has run. It usually goes through three stages:

  1. Set it before the loop starts: count = 1
  2. Test it in a decision: count <= 12? If Yes, run the loop steps. If No, leave the loop.
  3. Change it at the end of each time round: count = count + 1

Example 1: any times table

Try it: run the times-table loop

Type a number for n and step through. Watch count go up by 1 each time round. When does the loop stop? (Click Run to the end to go faster.)

Input (n):

StartInput ncount = 1count <= 12?NoYesStopanswer = n × countOutput n × count = answercount = count + 1

Variables

Output

What just happened

    Look at the arrow on the left: after count = count + 1, it goes back to the decision. When count reaches 13, count <= 12? is No, so the flowchart leaves the loop and stops. Twelve lines of output, but only one Output symbol!

    Example 2: the average of five numbers

    In the last-but-one post you averaged three numbers with three separate inputs. With a loop, one Input symbol can take as many numbers as you like. A running total starts at 0 and has each number added to it.

    Try it: run the average-of-five loop

    Type five numbers, then step through. Watch total grow each time round.

    Inputs (five numbers):

    Starttotal = 0count = 0count < 5?NoYesInput numtotal = total + numcount = count + 1average = total / 5Output averageStop

    Variables

    Output

    What just happened

      A Flowgorithm flowchart with a six-sided For loop shape that counts from start to stop, an output inside the loop, and End at the bottom.
      A counting loop in Flowgorithm. Flowgorithm has a special six-sided For shape that sets, tests and changes the counter all in one symbol. It does the same job as our decision diamond plus the count = count + 1 box.

      Image source: File:Flowgorithm For Loop.svg (Wikimedia Commons)

      Watch: a counting loop

      This video shows how to design a counting loop in a flowchart, and how to change where it starts, where it ends and how much it counts by.

      Video: Creating a Counting Loop in a Flowchart – Access 2 Learn – https://www.youtube.com/watch?v=wxvguFRrtIc

      Activity: trace the loop

      A trace table records the values of the variables each time round a loop. Copy and complete this one for the average-of-five flowchart, with the inputs 8, 6, 10, 4 and 7:

      Time roundnumtotalcountcount < 5?
      Before the loop–00Yes
      1881Yes
      26
      310
      44
      57

      Try it: check your trace

      Use your completed trace table.

      1. What is total after the 3rd time round?

      2. What is total when the loop ends?

      3. What is count when the loop ends?

      4. What is the output?

      5. In the times-table flowchart, how many lines are output when n = 9?

      Your turn

      • Change the times-table flowchart so it outputs only up to n × 5.
      • Draw a loop flowchart that outputs the numbers 1 to 10.
      • Challenge: draw a flowchart that inputs 5 marks and outputs how many of them are passes (50 or more). You will need a loop and a decision inside it.

      Self-check quiz

      Click the best answer. You get feedback straight away; only your first click counts towards your score.

      1. A loop is used to…

      2. In a flowchart, how can you tell where a loop is?

      3. What is the job of count = count + 1?

      4. A loop starts with count = 1 and keeps going while count <= 12. How many times does it run?

      5. Why does total start at 0?

      6. What would happen if a loop’s counter never changed?

      Related posts on islandclass.org

      For later, in Forms 4–5 (CSEC IT): these go deeper and are for when you reach CSEC Information Technology.

      Next: Scratch: Moving and Controlling Sprites

      Syllabus link: Forms 1–3 ICT curriculum, Module 5, Objective 5.12 – use flowchart symbols appropriately to represent an algorithm using a looping/repetition construct.

      Attributions to media used in this post:

      Updates

      2026/10/21

      - Fixed the activity code so its buttons keep working.

      © 2026 Vedesh Kungebeharry. All rights reserved.

      Leave a Reply