Lesson 1 - Algorithm and Flowcharting
Lesson 1 - Algorithm and Flowcharting
Lesson 1 - Algorithm and Flowcharting
ROWELL L. MARQUINA
Senior High School Teacher
TUNASAN NATIONAL HIGH SCHOOL
WHAT IS AN ALGORITHM?
An algorithm refers to a series of
well-defined instructions on how to
accomplish a task or solve a specific
problem.
▪ Giving directions on how to get to
somebody’s house is an algorithm.
▪ Following a recipe for baking a cake is
an algorithm.
▪ The steps to compute the for average
is also an algorithm.
IMAGE SOURCE:
https://imgbin.com/png/uxvDNRys/computer-programming-computer-icons-technology-algorithm-png
https://www.flaticon.com/free-icon/coding_1085774
STEPS IN CREATING AN ALGORITHM
In creating an algorithm, it is very
important to determine the exact goal
or expected product first.
The goal or expected product of the
algorithm is called OUTPUT.
IMAGE SOURCE:
https://imgbin.com/png/uxvDNRys/computer-programming-computer-icons-technology-algorithm-png
https://www.flaticon.com/free-icon/coding_1085774
STEPS IN CREATING AN ALGORITHM
After determining the output, the next
step is to identify the necessary
materials or elements needed to
accomplish the task.
The necessary materials or elements
for the program is called INPUT.
IMAGE SOURCE:
https://imgbin.com/png/uxvDNRys/computer-programming-computer-icons-technology-algorithm-png
https://www.flaticon.com/free-icon/coding_1085774
STEPS IN CREATING AN ALGORITHM
If the input and output are already
identified, it is time to list the steps
needed to accomplish the task.
The steps needed to accomplish the
task is referred to as the PROCESS.
IMAGE SOURCE:
https://imgbin.com/png/uxvDNRys/computer-programming-computer-icons-technology-algorithm-png
https://www.flaticon.com/free-icon/coding_1085774
CHARACTERISTICS OF AN ALGORITHM
▪ It should have well-defined input and output.
▪ The steps should be stated clearly and
unambiguously.
▪ It should have an exact start and end.
▪ It should be simple but precise.
▪ It should be practical.
IMAGE SOURCE:
https://imgbin.com/png/uxvDNRys/computer-programming-computer-icons-technology-algorithm-png
https://www.flaticon.com/free-icon/coding_1085774
WHAT IS A FLOWCHART?
A flowchart is a diagram that
illustrates a process, system
or computer algorithm.
Flowcharts are widely used in
multiple fields to document,
study, plan, improve and
communicate often complex
processes in clear, easy-to-
understand diagrams.
IMAGE SOURCE:
https://www.frevvo.com/blog/wp-content/uploads/2021/10/image5-2.png
FLOWCHART SYMBOLS
The American National
Standards Institute (ANSI) set
standards for flowcharts and
their symbols in the 1960s.
In 1970 the International
Organization for
Standardization (ISO)
adopted the ANSI symbols as
the international standard for
developing flowcharts.
IMAGE SOURCE:
https://uploads-ssl.webflow.com/6184b461a39ff13bfb8c0556/61de99e8171cc6468145551d_flowchart-symbols-800.png
FLOWCHART SYMBOLS
NAME OF
SYMBOL FUNCTION
SYMBOL
Indicates the beginning and end of the
Terminal Symbol
flowchart.
Its shows the process’ direction or the
Flowline Symbol
next steps in the process.
It shows the process or operations to
Process Symbol
be carried out by the program
It shows the step that contains a
Decision Symbol
control mechanism or decision.
It indicates the process of getting data
Input/Output
from the user or displaying data on
Symbol
screen.
IMAGE SOURCE:
https://uploads-ssl.webflow.com/6184b461a39ff13bfb8c0556/61de99e8171cc6468145551d_flowchart-symbols-800.png
FLOWCHART PROBLEM 1:
DETERMINING USER’S AGE:
Create a flowchart for a program
that will require the user to input
their year of birth. Using the user’s
year of birth, the program will
compute for the user’s age and
display its result on the computer
screen.
FLOWCHART SAMPLE
START The program is initiated.
1: birthyear, age The variables birthyear and age are introduced to the program as integers.
display The program displays the instruction “Enter Year of Birth: ” on screen .
“Enter Year of Birth:”
input The program get an input from the user and store its value in the variable birthyear.
birthyear
age = 2023 - birthyear The program computes for the value of age using the formula age = 2023 - birthyear.
1: kilo, pound The variables kilo and pound are introduced to the program.
display
“Enter Weight in The program displays the instruction “Enter Weight in Kilogram:” on screen.
Kilogram:”
input The program get an input from the user and store its value in the variable kilo.
kilo
pound = kilo * 2.2 The program computes for the value of pound using the formula pound = kilo*2.2.
1: length, width, area The variables length, width, and area are introduced to the program as integers.
display
“Enter Length of the The program displays the instruction “Enter Length of Rectangle: ” on screen .
Rectangle:”
input The program get an input from the user and store its value in the variable length.
length
display
“Enter Width of the The program displays the instruction “Enter Width of Rectangle: ” on screen .
Rectangle:”
input
The program get an input from the user and store its value in the width.
width
1:area = length * width The program computes for the value of area using the formula area = length*width.
display
The program displays the value of area on the screen.
area
1:
a, b, c, d, sum, product, square The variables a, b, c, d, sum, product, and square are introduced to the program.
display
“Enter the First The program displays the instruction “Enter the First Number: ” on screen .
Number:”
input The program get an input from the user and store its value in the variable a.
a
display
“Enter the Second The program displays the instruction “Enter the Second Number: ” on screen .
Number:”
input
The program get an input from the user and store its value in the b.
b
1: display
“Enter the Third
Number:”
The program displays the instruction “Enter the Third Number: ” on screen .
input The program get an input from the user and store its value in the variable c.
c
display
“Enter the Fourth The program displays the instruction “Enter the Fourth Number: ” on screen .
Number:”
input
The program get an input from the user and store its value in the d.
d
1: sum = a + b The program computes for the value of sum using the formula sum = a + b.
product = c * d The program computes for the value of product using the formula product = c*d.
square = b * b The program computes for the value of square using the formula square = b*b.
display
The program displays the value of sum on the screen.
sum
display
The program displays the value of product on the screen.
product
1: a, b, c, d, cube, half,
twentypercent, times100
The variables a, b, c, d, cube, half, twentypercent, and times100 are
introduced to the program.
display
“Enter the First The program displays the instruction “Enter the First Number: ” on screen .
Number:”
input The program get an input from the user and store its value in the variable a.
a
display
“Enter the Second The program displays the instruction “Enter the Second Number: ” on screen .
Number:”
input
The program get an input from the user and store its value in the b.
b
1: display
“Enter the Third
Number:”
The program displays the instruction “Enter the Third Number: ” on screen .
input The program get an input from the user and store its value in the variable c.
c
display
“Enter the Fourth The program displays the instruction “Enter the Fourth Number: ” on screen .
Number:”
input
The program get an input from the user and store its value in the d.
d
1: cube = a*a*a The program computes for the value of cube using the formula cube = a*a*a.
half = b / 2 The program computes for the value of half using the formula half = b / 2.
The program computes for the value of twentypercent using the formula
twentypercent = c * 0.20
twentypercent = c*0.20.
times100 = d * 100 The program computes for the value of times100 using the formula times100 = d*100.
display
The program displays the value of cube on the screen.
cube
display
The program displays the value of half on the screen.
half
display
The program displays the value of times100 on the screen.
times100
Email Address:
[email protected]
[email protected]
[email protected]