Algorithm to Find Biggest of Three Numbers!

Biggest of the three numbers: In this article, I am going to explain how to write an algorithm to find the biggest of three given numbers.

If you are a beginners level programmer, it is very important for you to understand how to write an algorithm before even writing a computer program to solve any problem.

To find the biggest of three numbers, you need three variables to store three numbers given by the user. So, here I take three letters A, B, and C to store the corresponding numbers.

Step 1: INPUT A, B, C

Step 2: IF (A > B) THEN

         Begin

                    IF ( A > C) THEN

                    Write “Biggest number is “, A

                    ELSE 

                    Write “ Biggest number is “, C

        End

ELSE

        Begin

                IF ( B > C) THEn

                Write “ Biggest number is “, B

               ELSE

                     Write “ Biggest number is “, C

               End

Step 3: END

Explanation:

There are a few steps that need to be considered before writing your algorithm;

  • User Input: Here it is clear that you need only three numbers as input from the user as the problem is to find the biggest of three numbers. The inputs may be any integer or floating numbers.
  • Conditional Statements: These statements are basically used to compare the values of variables. Here you are comparing the values of A, B, and C to check which one is the biggest among the tree numbers given by the user.
  • The sequence of Statements: One of the important things in writing an algorithm is to maintain the sequence of statements which is denoted by numbers like 1, 2, and 3, etc.

Step 1: 

The INPUT word is used to denote the user input.

Step 2: 

The statement IF( A > B ) is used to compare the value of A with B and if the condition is true then again we will compare the value of  A with C. 

If the condition (A > C) becomes true then the biggest number is A, and if the condition becomes false then the biggest number is C.

And if the above condition is not true then you need to compare the value of B and C.

So here you can use the statement IF ( B > C) to compare the value of B with the value of C. And if the condition is true then B is the biggest number.

Again, if the value of B is not bigger than the value of C then C is the biggest number among the three numbers given by the user.

Conclusion:

I hope you understand how to write an algorithm to find the biggest of the three numbers in this article. You can use this algorithm to write programs in any language like C, C++, Java, .Net, etc.

If you have any questions, then feel free to write in the comment box.