Professional Documents
Culture Documents
Flowchar & Pseudocode
Flowchar & Pseudocode
PSEUDOCODE
MO3AZ
Q1: Write an algorithm and draw a flowchart to find the average of 3 integers.
Pseudocode Flowchart
START
Start
READ n1,n2,n3
SET Avg (n1+n2+n3)/3
PRINT Avg Read n1, n2 , n3
END
Avg = (n1 + n2 + n3 ) / 3
Print Avg
End
MO3AZ
SAIF
Q2: Write an algorithm and draw a flowchart to find the largest of two numbers.
Pseudocode Flowchart
START
READ a , b Start
IF a > b THEN
PRINT a Read a , b
ELSE
PRINT b YES NO
a>b?
END IF
END
Print a Print b
End
MO3AZ
SAIF
Q3: Write an algorithm and draw a flowchart to find the largest of three numbers.
Pseudocode Flowchart
START
Start
READ a , b , c
IF a >= b AND a >= c THEN
Read a, b , c
PRINT a
ELSE
YES a >= b && NO
IF b >= a AND b >= c THEN a >= c ?
b >= a &&
PRINT b
NO b >= c ?
ELSE
Print c YES
PRINT c
END IF Print a Print b
END IF End
END
MO3AZ
SAIF
Q4: Write an algorithm and draw flowchart to print natural numbers from 1 to 100.
Pseudocode Flowchart
START
SET i 1 Start
WHILE i <= 100 DO
PRINT i i=1
SET i i + 1
YES i <= 100 ? NO
END WHILE
END Print i
i=i+1
End
MO3AZ
SAIF
Q5: Write an algorithm and draw flowchart to print summation of natural numbers Between 0 to 100.
Pseudocode Flowchart
START
Start
SET i 0 , Sum 0
WHILE i <= 100 DO
SET Sum Sum + i i = 0 , Sum = 0
SET i i + 1
YES NO
END WHILE i <= 100 ?
PRINT Sum
Sum = Sum + i Print Sum
END
i=i+1
End
MO3AZ
SAIF
Q6: Write an algorithm and draw a flowchart to find factorial of n.
Pseudocode Flowchart
START
Start
READ n
SET i 1 , Fact 1 Read n
WHILE i <= n DO
i = 1 , Fact = 1
SET Fact = Fact * i
SET i i + 1 YES NO
i <= n ?
END WHILE
PRINT Fact Fact = Fact * i
Print Fact
END
i=i+1
End
MO3AZ
SAIF
QUESTIONS TIME !
MO3AZ