WhatsApp us

Find largest among three numbers using nested if else in C Programming

  • Tech Area
  • Last updated on: January 8, 2026



In this tutorial, We will see how to find largest among three numbers using nested if else in C programming language.

Program to find largest among three numbers

#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c;
clrscr();
printf("Enter three numbers ");
scanf("%d%d%d", &a,&b,&c);
if(a>b)
{
     if(a>c)
    {
     printf("%d is greater than %d, %d", a,b,c);
     }
     else
    {
     printf("%d is greater than %d, %d", c,a,b);
     }
}
else if(b>c)
     {
      printf("%d is greater than %d, %d", b,a,c);
     }
      else
     {
      printf("%d is greater than %d, %d", c,a,b);
     }
getch();
} 

Output

Enter three numbers 10 8 5
10 is greater than 8,5

In this program, the user is asked to enter three integers. These three integers are stored in variables a, b and c respectively.

printf("Enter three numbers ");
scanf("%d%d%d", &a,&b,&c);

Then, check variable a greater than b and a greater than c.

if(a>b)
{
     if(a>c)
    {
     printf("%d is greater than %d, %d", a,b,c);
     }
     else
    {
     printf("%d is greater than %d, %d", c,a,b);
     }
}

If, above condition is false than check variable b greater than c.

else if(b>c)
     {
      printf("%d is greater than %d, %d", b,a,c);
      }
      else
      {
       printf("%d is greater than %d, %d", c,a,b);
       }

The printf() function is used to display the biggest numbers.


Subscribe us via Email

Join 20,000+ subscriber

Subscribe on YouTube

PHP Projects
Matrimonial Portal Project in PHP & MySQL Last Updated: December 22, 2025
Event Management System Project in PHP & MySQL Last Updated: December 6, 2025
Online Shopping System Project in PHP MySQL Last Updated: November 26, 2025
Hostel management system project in PHP and MySQL Last Updated: February 14, 2024
Online Pizza Delivery project in PHP Last Updated: February 4, 2024
Parking Management System project in PHP Last Updated: November 5, 2023
Visitors Management System project in PHP Last Updated: August 28, 2023
SNIPE – IT Asset management system v6.1.0 Last Updated: April 21, 2023
Employee Management System project in PHP Last Updated: January 21, 2023