• Post author:
• Post category:C Programs

In this article, you will be able to learn how to find the largest number among three numbers in c programming language.

## C Program to Find the Largest Number Among Three Numbers using if-else Ladder

### Methodology

• Input 3 numbers.
• Check if a number is greater than the other two numbers.
• Repeat the check process for the other two numbers.
• Print the largest number.

### Program

``````//C program to find the largest number among three numbers using if..else ladder
#include<stdio.h>
int main()
{
int var1,var2,var3;
printf("Enter three numbers \n");
scanf("%d %d %d",&var1,&var2,&var3);
if(var1>=var2 && var1>=var3)
printf("Largest number is %d\n",var1);
else if(var2>=var1 && var2>=var3)
printf("Largest number is %d\n",var2);
else
printf("Largest number is %d \n",var3);
return 0;
}
``````

### Code Explanation

First, declare 3 variables of integer type. Then using printf() function print “Enter three numbers”. using scanf() function read the three numbers entered by the user. Then using the if..else ladder find the largest number among the three. After finding the largest number, using printf() function print the result onto the console.