Flow Charts
Flow Charts
Flow Charts
LO1
HCT ACADEMIC FORUM FALL 2017
TERMINATOR
(START / STOP) DECISION DOCUMENTATION
(PRINT-OUT)
ON-PAGE CONNECTOR
OFF-PAGE CONNECTOR
TRUE FALSE
FALSE
TRUE
4
Flowchart Examples
EXERCISES: SEQUENCE
Draw a flowchart that will ask the user to input two numbers and
will print the sum and product of these two numbers:
SAMPLE DISPLAY:
5
START
A=0
B=0
Sum = 0
Prod = 0
Input A, B
Sum = A + B
Prod = A * B
Print Sum,
Prod
STOP
6
EXERCISES: SEQUENCE
SAMPLE DISPLAY:
7
START
F=0
C=0
Input F
C = ( F – 32 ) * (
5/9 )
Print C
STOP
8
EXERCISES: IF-ELSE
Draw a flowchart that will ask the user to input the name and
grade of a student. The algorithm will then print the name and
grade of the student plus whether they passed or failed:
SAMPLE DISPLAY:
9
START
Name = “ “
Grade = 0
Rem = “ “
STOP
10
EXERCISES: IF-ELSE
Draw a flowchart that will ask the user to input the name and
score of an employee. The algorithm will then print the name and
score of the employee as well as a remark about their
performance as follows:
SAMPLE DISPLAY:
Input name and score and press <ENTER> key: James 3.2
James 3.2 Needs Improvement
11
START
Name = “ “
Score = 0
Rem = “ “
TRUE FALSE
Score < 3
Rem = “Needs
Improvement” TRUE FALSE
Score < 4
Rem =
“Satisfactory” TRUE Score < FALSE
4.5
STOP
12
EXERCISES: LOOPS
SAMPLE DISPLAY:
1 2 3 4 5 6 7 8 9 10
13
Solution 2
Solution 1
START
START
X=0
X=1
FALSE
FALSE X < 10 STOP
X <= 10 STOP
TRUE
TRUE
X=X+1
Print X
Print X
X=X+1
14
EXERCISES: LOOPS
Draw a flowchart that will print the area of a circle when the radius
r takes values between 1 and 5. The area of a circle is 𝜋𝑟 2
SAMPLE DISPLAY:
1 3.1416
2 12.5664
3 28.2744
4 50.2656
5 78.54
15
Solution 3
Solution 2
Solution 1 STAR
STAR T
STAR T
T Pi =
Pi = 3.1416
Pi = 3.1416 R=0
3.1416 R=1 A=0
R=1 A=0
A=0
R=R+1
R <= FALSE
A = Pi * R * 5
R
TRUE R <= FALSE
A = Pi * R * 5
Print R,
A R TRUE
TRUE A = Pi * R *
Print R, R
R=R+1 A
Print R,
R=R+1 A
R <=
5
FALSE
STOP
STOP
STOP
16
No Exponent in C
Remember that in C language there is no symbol for calculating the
power or exponent.
If you need to calculate power, use a loop to multiply a number as
many times as necessary.
17
Introduction to Dev-C++
• Preprocessor
• Compiler
18