Page 87 - TechPluse_C6_Flipbook
P. 87
SOLVING PROBLEMS USING ALGORITHMS AND
FLOWCHARTS
Example 1: Write an algorithm to find out whether an individual is eligible for vote or not.
Algorithm: Flowchart:
Step 1 Start
Start
Step 2 Input Age
Step 3 If age >= 18, print
"ELIGIBLE" INPUT AGE
Else, print "NOT
ELIGIBLE"
Step 4 Stop NO
IS AGE
DISPLAY "NOT ELIGIBLE FOR VOTE"
>=18?
YES
DISPLAY "ELIGIBLE FOR VOTE"
Stop
Example 2: Write an algorithm and draw a flowchart to check weather a given number is
even or odd. Flowchart:
Algorithm:
Start
Step 1 Start
Step 2 Read Number
Step 3 Check If Number % 2 == 0 Then
Read a Number
print "Number is Even."
Else
print "Number is Odd."
Is
Step 4 Stop
Number%2==0
Yes NO
Number is even Number is odd
Stop
Algorithm and Flowchart 85

