☰ Year plan · Communication Technology

Algorithms and flowcharts

Week 4 · Unit 1, Lesson 2 Artificial Intelligence Algorithms (1) · 3 lessons
2

Flowchart shapes and their jobs

ICT Prep 3 Term 1, Unit 1, Lesson 2: pp. 19–22
GoalName the four flowchart shapes, say what each one does, and draw a small flowchart.
New words
flowchart · a drawing of an algorithm with shapes and arrowsoval · the shape that marks the start and the endparallelogram · the shape for input and outputdiamond · the shape for a decision with a yes and a no way out
Explanation

A flowchart draws an algorithm so that we can see it at a glance. It uses four shapes. The oval shows the start and the end. The rectangle shows a process, such as a calculation. The parallelogram shows input or output: reading a value or showing a message. The diamond shows a decision, a question with a yes way and a no way. Arrows join the shapes and show the direction. The rules are simple: one start, at least one end, arrows that always point in a clear direction, and every diamond has a yes arrow and a no arrow. Flowcharts are useful before coding because a mistake is easy to see on a drawing and cheap to change.

ShapeIts jobExample text inside
ovalstart or endStart
rectanglea processtotal = a + b
parallelograminput or outputread a, b
diamonda decisionnum > 0 ?
Worked examples
Startread a, btotal = a + bshow totalEnd
This flowchart adds two numbers. Start, read a and b (parallelogram), calculate total (rectangle), show total (parallelogram), end. It has no diamond because nothing is decided.
Startread temptemp > 30yesnoHotNot hotEnd
This flowchart reads a temperature and decides. The diamond asks whether temp > 30. The yes arrow leads to Hot and the no arrow leads to Not hot. Both ways meet again at the end.
Class activity

Draw a flowchart on paper for this algorithm: read a mark; if the mark is at least 50 show Pass, otherwise show Fail. Name each shape you use. Check that the diamond has two labelled arrows.

Practice
1
Which shape marks the start and the end?
2
Which shape do you use for “read a number”?
3
What must every diamond have?
4
Where would total = a + b go in a flowchart?