HOW TO MAKE
AN ALGORITHM
AND FLOWCHART
By Muhongya
• Logical step-by-step method to
solve the problem, in other
words, an algorithm is a
procedure for solving problems.
ALGORITHM • Used to solve a mathematical or
computer problem, this is the
first step in the process.
• An algorithm includes
calculations, reasoning, and data
processing.
• A flowchart is the graphical or
pictorial representation of an
algorithm with the help of different
symbols, shapes, and arrows to
demonstrate a process or a FLOWCHART
program.
• The main purpose of using a
flowchart is to analyze different
methods.
Common symbols applied in a flowchart:
Terminal Box –Start / End
Input / Output
Process / Instruction
Decision
Connector / Arrow
Now Let’s
try solving a
problem!!!
1. Compute the average of three
FLOWCHART
numbers.
ALGORITHM
• Step 1: Start START
• Step 2: Declare variables num1, num2,
Read
num3 and average. num1,
num2 and
• Step 3: Read values of num1, num2 and num3.
num3.
average =
• Step 4: Find the average using the formula: (num1 + num2 + num3) / 3
average = (num1 + num2 +num3) / 3
Display
• Step 5: Display average. average
• Step 6: End.
END
2. DETERMINE IF THE NUMBER GIVEN FLOWCHART
BY THE USER IS ODD OR EVEN.
ALGORITHM START
• Step 1: Start Input
number
• Step 2: Declare number and remainder.
remainder = number %
• Step 3: Input number. 2
• Step 4: Find the remainder of the
remainder ==
number divided by 2 using the formula: 0
remainder = number % 2 FALSE TRUE
• Step 5: Check:
ODD EVEN
if remainder == 0, then display
“EVEN”.
else, display “ODD”.
• Step 6: End. END
3. FIND THE LARGEST AMONG THREE DIFFERENT NUMBERS
ENTERED BY THE USER.
ALGORITHM
• Step 1: Start
• Step 2: Declare variables num1, num2, num3 and average.
• Step 3: Input num1, num2 and num3.
• Step 4: Check:
if num1 > num2 && num1 >num3, display “num1 is
the largest”.
else, check:
if num2 > num3, display “num2 is the largest”
else, display “num3 is the largest”.
• Step 6: End.
START FLOWCHART
Input num1,
num2, num3
num1 >
num2 && FALSE
num1 >
TRUE num3
num2 >
num3
num1 is
the largest TRUE FALSE
num2 is num3 is
the largest the largest
END
PSEUDOCODE
Pseudocode is an informal way of describing the steps of
a programs solution without using a strict programming
language syntax
PSEUDOCODE
• WHILE TRUE- once there is power
• INPUT – check the value of the switch
• if switch is 0 or off
• RETURN – go back to main logic
• if switch is 1 or on
• INPUT – Check the value of the motion sensor
• if motion sensor value is 0 or off
PSEUDOCODE
• RETURN – go back to main logic
• IF motion sensor value is 1 or there is motion:
• OUTPUT –Flash LEDs.
• OUTPUT-Sound buzzer.
• OUTPUT –Send email.
• OUTPUT – Send text message
•
BLOCK DIAGRAM
• Is a visual representation of the
system's components and their
interactions, illustrating how different
elements (like sensors, gateways, and
cloud servers) connect and
communicate to achieve a specific
BLOCK DIAGRAM OF AN IOT SYSTEM