lesson 4
FLOWCHART CONTROL STRUCTURE
SELECTION
CONTROL
STRUCTURE
BEGIN
SELECTION
CONTROL INPUT
DATA
STRUCTURE
CHECK
⚫ Used to test a DATA
condition and
provides for a choice PROCESS PROCESS
of one between two DATA DATA
alternatives
OUTPUT OUTPUT
DATA DATA
END
SELECTION CONTROL STRUCTURE
e.g.
1. Make a flowchart that will accept as input
a speed of an automobile. Display “over
speeding” if the speed is more than 60
kph. Else, display “normal speed”.
1. START
Speed = 0
Speed
Speed > N
60
Y
“Over speeding” “Normal
speed”
END
e.g.
2. Given the numbers X, Y and Z; prepare a
flowchart to determine and print the
following:
a. If X is greater than Y, then print Z.
b. If X is greater than Z, then print the
difference between Y and Z.
c. If X is equal to 100, then print the
sum of the numbers.
2. START
X = 0, Y = 0, Z = 0
SUM = 0, DIFF = 0
X Y Z
Y
X>Y Z
N
Y
X>Z DIFF = Y - Z DIFF
N
Y
X = 100 SUM = X + Y + Z SUM
A N
A
END
EXERCISES
1. A college student who is registered for
15 units or more is considered a full –
time student. The tuition fee for a full
time student is P2,000.00. A part – time
student is charged P150.00 per unit for
tuition. Given the number of units a
student is registering, prepare a
flowchart that will calculate and print his
tuition fee on the basis of the given
criterion.
2. Input a number. Prepare a flowchart that
would print the number and the message
“Within Range” if it is between 20 and 30,
inclusive. Otherwise, the message is
“Out of Range”.
3. An instructor uses the following scheme
to award letter grades on an
examination:
90 – 100 A
80 – 89 B
70 – 79 C
60 – 69 D
0 – 59 E
Given the numeric grade, what is its
equivalent letter grade?