Dsa ch2-1 Flowchart
Dsa ch2-1 Flowchart
Chapter :
Flowchart, Pseudo code,
Algorithm
Imran Ali Memon
IT Department
Contents
1. Flowchart Definition
2. Flowchart Symbols
3. Pseudo code
4. Examples
1. The Flowchart
• A graphical representation of the sequence of
operations/instructions in system/program.
• Shows how data flows from sources.
• Shows logic of an algorithm.
• Highlighting individual steps and their
interconnections.
• Control flow from one action to next.
2. Flowchart Symbols
Name Symbol Use in Flowchart
Flowchart
GRADE <-(M1+M2+M3+M4)/4
YES NO
IS
GRADE >50
PRINT PRINT
“PASS” “FAIL”
STOP
Program
#include<iostream.h>
#include<conio.h>
int main(){
int m1, m2, m3, m4, grade;
clrscr();
cin>>m1>>m2>>m3>>m4;
grade = (m1+m2+m3+m4)/4;
if(grade < 50 )
cout<< “fail”;
else
cout<< “pass”;
getch();
return 0;
}
Assignments
Write an algorithm , pseudo code, draw flowchart &
program:
1. To convert the length in feet to centimeter.
2. That will read the two sides of a rectangle and
calculate its area.
3. That reads two values, determines the largest value
and prints the largest value with message.
4. That reads three numbers and prints the value of
largest number.
5. Calculator (+,-,x,/)