FLOWCHARTS
The Flowchart
• A graphical representation of the sequence of operations in an information system
or program.
• Program flowcharts show the sequence of instructions in a single program or
subroutine. Different symbols are used to draw each type of flowchart.
• shows logic of an algorithm
• emphasizes individual steps and their interconnections
What are those symbols?
• START/END (Oval)
• INPUT/OUTPUT (Parallelogram)
• PROCESS (Rectangle)
• DECISION (Diamond)
• Directions
Example
START Question: Write an algorithm to find the sum
of three given numbers?
Input
N1,N2,N3
Algorithm:
Sum=N1+N2+N3 Step 1: Input N1,N2,N3
Step 2: Sum=N1+N2+N3
Step 3: Print Sum
Display
Result
STOP
Example
START Question: Write an algorithm to find the sum
and product of the two given numbers?
Input
N1,N2
Algorithm:
Sum=N1+N2 Step 1: Input N1,N2
Product=N1*N2 Step 2: Sum=N1+N2
Step 3: Product=N1*N2
Display Sum
Step 4: Print Sum
Display Product
Step 5: Print Product
STOP
Example
START Question: Find the sum and average of three
given numbers?
Input
N1,N2,N3
Algorithm:
Step 1: Input N1,N2,N3
Sum=N1+N2+N3 Step 2: Sum=N1+N2+N3
Average=Sum/3 Step 3: Average=Sum/3
Step 4: Print Sum
Display Sum
Step 5: Print Average
Display Average
STOP
Example
START
Question: Write an algorithm to determine a
student’s final grade and indicate whether it is
Input
M1,M2,M3,M4
passing or failing. The final grade is calculated
as the average of four marks.
GRADE=(M1+M2+M3+M4)/4
Algorithm:
Step 1: Input M1,M2,M3,M4
N IS Y Step 2: GRADE =(M1+M2+M3+M4)/4
GRADE<50 Step 3: if (GRADE < 50) then
Print “FAIL”
else
Display
“Pass”
Display
“Fail”
Print “PASS”
endif
STOP