Professional Documents
Culture Documents
Algorith Flowchart
Algorith Flowchart
Algorith Flowchart
ALGORITHMS AND
FLOWCHARTS
by: eestrellado2022
ALGORITHMS AND FLOWCHARTS
◼ A typical programming task can be divided into
two phases:
◼ Problem solving phase
produce an ordered sequence of steps that describe
solution of problem
this sequence of steps is called an algorithm
◼ Implementation phase
implement the program in using suitable programming
languages
Steps in Problem Solving
◼ Step 1: Input M, F
◼ Step 2: FG = (M + F)/2
◼ Step 3: PRINT/DISPLAY FG
◼ Note: M = Midterm
F = Finals
2 = two terms
Writing an Algorithm & draw a
flowchart
◼ Example 2: Write an algorithm and draw a
flowchart, to compute the sum of three
even numbers (14, 20, 34).
ALGORITHM FLOWCHART
◼ Step 1: Input X, Y, Z
or
◼ Step 1: Input 14, 20, 34
◼ Step 3: PRINT/DISPLAY
◼ SUM = 68
Problem #3
(WITH DECISION SYMBOL)
◼Example 3: Write an algorithm and draw a
flowchart to determine a student’s final
grade and indicate a remarks whether it is
“PASSED” or “FAILED” grade. The final
grade is calculated as the average of four
marks.
EXAMPLE: Find the average of :
Q1, Q1,Q3, Q4
◼ In this example we are going to validate
the result using IF Function or IF
statement , so decision symbol will be use.
◼ The IF function is one of the most popular
functions in Excel, and it allows you to
make logical comparisons between a
value and what you expect.
An IF statement can have two results. The
first result is if your comparison is True, the
second if your comparison is False.
◼ IF statement/logical statement is defined
as a function which “checks whether a
condition is met, returns one value if True
and another value if False”.
◼ IF, THEN, ELSE. If something is true,
then do this, else/otherwise do that.
Input
L, M, N, O
FG = (L + M + N + O) /4
N IF Y
GRADE<75
PRINT PRINT
“PASSED” “FAILED”
END
Algorithm
◼ Detailed Algorithm
◼ Step 1: Input L=80, M=87, N=85, O=90
Step 2: FG = (80+87+85+90) /4
FG = 85.5
Step 3: If (GRADE < 75) (FALSE) then
Print “FAILED”
else
Print “PASSED”
end If
Example Flowchart
START
Input
L=80, M=87, N=85, O=90
FG = (80+87+85+90) /4
FG = 85.5
FALSE IF
GRADE<75
PRINT
“PASSED”
END
Algorithm
◼ Detailed Algorithm
◼ Step 1: Input L=67, M=67, N=65, O=60
Step 2: FG = (67+67+65+60) /4
FG = 64.75
Step 3: If (GRADE < 75) (TRUE) then
Print “FAILED”
else
Print “PASSED”
end If
Example Flowchart
START
Input
L=67, M=67, N=65, O=60
FG = (67+67+65+60) /4
FG = 64.75
IF TRUE
GRADE<75
PRINT
“FAILED”
END
DECISION STRUCTURES
◼ The expression A>B or A< B is a logical
expression
◼ it describes a condition we want to test
◼ if A>B is true (if A is greater than B) we take
the action to the right, display/print the result for
the value of A and display the “remarks”
◼ if A>B is false (if A is not greater than B) we
take the action to the right, display/print the
result for the value of B and display the
“remarks”
DECISION STRUCTURES
Structure:
Y N
is
A>B
Print Print
A B
IF–THEN–ELSE STRUCTURE
◼ The structure is as follows
If condition is TRUE display “remarks”
else
FALSE display “remarks”
endif
IF–THEN–ELSE STRUCTURE
◼ The algorithm for the flowchart is as
follows:
If A>B then
Y N
print A is
A>B
else
print B Print
A
Print
B
endif
Relational Operators
Operator Description
> Greater than
= Equal to
Not equal to
References:
◼ http://www.yspuniversity.ac.in/cic/algorithm-manual.pdf
◼ https://byjus.com/maths/even-
numbers/#:~:text=What%20is%20an%20Even%20Number,%2C%2
012%2C%2014%2C%2016.
◼ https://corporatefinanceinstitute.com/resources/excel/study/excel-if-
statement/#:~:text=The%20IF%20statement%20is%20a,of%20code
%20evaluates%20to%20FALSE.
◼ https://engineerstutor.com/2020/10/08/solved-assignment-problems-
algorithms-and-flowcharts/