Largest among three numbers

This program prints the largest among three numbers. It takes three numbers from the user, so the output depends on the user input. And finds the largest among the three numbers.

Hello World – My first C Program

List of basic C programs


There are several ways to do this program, but in our code, we are using if else statement. We have taken three variables A, B, and C for three numbers.

Then we are checking if ‘a’ is greater than ‘b’ and ‘c’. If ‘a’ is greater than both ‘b’ and ‘c’, then ‘a’ is the largest number.

In the same way, we are checking if ‘b’ is greater than both ‘a’ and ‘c’. If it is then ‘b’ is the largest number.

If both the above two conditions┬ádo not satisfy, then the only number is left is ‘c’ or the third number. In this case, ‘c’ is the largest number.

This was a simple program. Hope you have understood the explanation. Still, if you have any doubts, please don’t hesitate to drop your query in the comment section below. We are always here to help you.

Rectangular shaped pattern with letters – C Program

C program to print rectangular shaped pattern with numbers

Check whether a three digit number is Armstrong or not – C Program

Largest among three numbers using if else – C Program
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *