22 min read
Reading and Completing Flowcharts
Work out what a flowchart outputs for given inputs, and fill in the missing symbols of a partly drawn flowchart.
Reading a Flowchart
To read a flowchart, follow the arrows with your finger, writing down the value of every variable as it changes. At each decision, work out Yes or No using the current values.
What does this flowchart do?
Read this flowchart as text
- Terminator: Start (then → INPUT a, b)
- Input/output: INPUT a, b (then → a > b?)
- Decision: a > b? (Yes → big = a; No → big = b)
- Process: big = b (then → OUTPUT big)
- Process: big = a (then → OUTPUT big)
- Input/output: OUTPUT big (then → Stop)
- Terminator: Stop
Completing a Flowchart
In exams you may see a flowchart with empty symbols labelled A, B, C. Use the shape of each gap and the arrows around it to work out what belongs there.
Fill in A, B and C
Read this flowchart as text
- Terminator: Start (then → INPUT quantity)
- Input/output: INPUT quantity (then → [blank A])
- Decision: [blank A] (Yes → price = quantity × 90; No → [blank B])
- Process: [blank B] (then → [blank C])
- Process: price = quantity × 90 (then → [blank C])
- Input/output: [blank C] (then → Stop)
- Terminator: Stop
A Method for Gaps
- Shape first: diamond → a yes/no question; rectangle → a calculation; parallelogram → INPUT or OUTPUT.
- Look above and below: what values exist before the gap, and which are used after it?
- Read the labels: what happens on the Yes path tells you what the question must be.
- Test: trace one input through your completed flowchart.
Practice
A flowchart inputs a number, checks "number < 0?", and on Yes sets number = number × −1, then outputs number. What does it do?
More lessons in Algorithms, Flowcharts and Pseudocode · Next: Pseudocode Basics · Previous: Loops in Flowcharts
