A flowchart shows an algorithm as symbols joined by arrows. A good one has a single start, a clear path for every outcome, and an end that every path reaches.
This lesson is part of problem solving and algorithms. If the steps themselves are unclear, revisit breaking a problem into smaller tasks.
What does each symbol mean?
Match each symbol to the kind of pseudocode it replaces.
| Symbol | Meaning | Pseudocode it replaces |
|---|---|---|
| Oval | Start or end | (program begins or ends) |
| Parallelogram | Input or output | INPUT hours, OUTPUT fee |
| Rectangle | Process | SET fee = 2 |
| Diamond | Decision | IF hours <= 1 |
Arrows carry the flow from one symbol to the next. Every symbol except the end oval has an arrow leaving it.
Worked example: a parking fee
A car park charges RM2 for the first hour or part of it, and RM1 for each extra hour. Input is the whole number of hours parked, and output is the fee.
Build the flowchart in this order:
- Oval: Start.
- Parallelogram: INPUT hours.
- Diamond: hours <= 1?
- Yes branch, rectangle: SET fee = 2.
- No branch, rectangle: SET fee = 2 + (hours − 1) × 1.
- Both branches join at a parallelogram: OUTPUT fee.
- Oval: End.
Test it with 4 hours. The diamond asks 4 <= 1, which is false, so the No branch runs: fee = 2 + 3 × 1 = RM5. With 1 hour the Yes branch gives RM2.
What is the most common flowchart mistake?
A common slip is to draw the diamond, follow the Yes arrow and forget the No arrow.
| Drawing | Problem |
|---|---|
| Diamond with only a Yes exit | Inputs that fail the test go nowhere |
| Diamond with both exits labelled and joined | Every input reaches the end |
A quick check is to pick one input for each branch and follow the arrows with your pencil. If the pencil gets stuck, a path is missing.
Check yourself
Describe a flowchart that reads a mark and outputs “Grade A” if the mark is 80 or more, otherwise “Not A”. Which symbols are needed, and what is the output for 79?
Answer
Use an oval for Start, a parallelogram for INPUT mark, a diamond for mark >= 80?, two parallelograms for the two outputs, and an oval for End. The Yes exit goes to “Grade A”, the No exit goes to “Not A”, and both lead to End.
For 79, 79 >= 80 is false, so the output is Not A.
What to study next
Next, learn how to test that your design handles every kind of input in testing normal, boundary and invalid inputs. Use the restricted pseudocode trace trainer to trace the pseudocode version of your flowchart.
If you would like a teacher to check your diagrams, see online one-to-one Computer Science tuition.