Loading...

Largest of three numbers using nested-if-else

Programme:

#include<stdio.h>

int main()
{
  int a,b,c;
  printf("Enter the three numbers : \n");
  scanf("%d%d%d",&a,&b,&c);
  if(a<b)
  {
    if(b<c)
    {
      printf("Largest number is : %d",c);
    }
    else
    if(b>c)
    {
      printf("Largest number is : %d",b);
    }
  }
  else
    printf("Largest number is : %d",a);
}

Output:

Enter the three numbers : 
5
4
3
Largest number is : 5