In this post students will be able to learn how to find the largest of three numbers.
Page Contents
Draw the flowchart for finding largest of three numbers and write an algorithm and explain it.
Algorithm:
1.Start
2.Enter three variables X,Y,Z.
3.If X>Y and X>Z, print X is the greatest
4.Otherwise, If Y>X and Y>Z, print Y is the greatest
5.Otherwise, print Z is the greatest
6.Stop
Flowchart:

The algorithm starts by inputting three numbers A, B, and C. It then checks if A is greater than B, and if so, it checks if A is greater than C.
If A is greater than C, then A is the largest number, and it is displayed as the output. If A is not greater than C, then C is the largest number, and it is displayed as the output.
|
If A is not greater than B, then the algorithm checks if B is greater than C. If so, then B is the largest number, and it is displayed as the output. If not, then C is the largest number, and it is displayed as the output. The algorithm then ends.