Algorithms as Flowchart
FLOWCHARTS
A flowchart is a graphical representation of
the sequence of operations in a program.
An algorithm can be represented graphically
using a flowchart.
2
FLOWCHART NOTATIONS
Symbol Semantic
Start/End
Process
Input/Output
Test
Connector
Flow of activities
3
FLOWCHART: EXAMPLE 1
Start Algorithm starts here
Input
Gregorian Input data from user
date
Convert Gregorian
date to Islamic date Perform the date conversion
Display
Islamic Display the result
date
End Algorithm ends here
4
PSEUDOCODE
An outline of a program, written in a form that
can easily be converted into real programming
statements. It resembles the actual program
that will be implemented later. However, it
cannot be compiled nor executed.
Pseudocode normally codes the following
actions:
◦ Initialisation of variables
◦ Assignment of values to the variables
◦ Arithmetic operations
◦ Relational operations
5
EXAMPLE OF PSEUDOCODE
1. Start
2. Read quantity
3. Read price_per_kg
4. price 🡨 quantity * price_per_kg
5. Print price
6. End
6
FLOWCHART: EXAMPLE 2
Start
• length, width and
area are referred to
Input
length, width as variables.
• A variable is like a box
in which a value can
area ← length X width be stored
Output
area
End
7
FLOWCHART: EXAMPLE 3
Selection Start
Input
height
false true
height > 1.6?
Output Output
“You are “You are
short!” tall!”
End
8
FLOWCHART: EXAMPLE 4
Repetition (looping)
Start
Output
“Thank you!”
Input
stop
false
stop = 1?
true
End
9
YOU SHOULD NOW KNOW…
what flowcharts are.
how to represent algorithms graphically using
flowcharts.
10