Find greatest among 3 numbers - C Program

C program to read greatest amongst 3 numbers. Using nested if.

Solution:

#include <stdio.h>
int main()
{
     int a,b,c;
     printf("\tEnter Three Numbers\n");
     printf("--------------------------------\n");
     printf("Enter First Number  : ");
     scanf("%d", &a);
     printf("\nEnter Second Number : ");
     scanf("%d",&b);
     printf("\nEnter Third Number  : ");
     scanf("%d",&c);
     printf("--------------------------------\n");
     if(a>b)
     {
          if(a>c)
          {
               printf("a = %d is Greater", a);
          }
          else
          {
               printf("c = %d is Greater", c);
          }
     }
     else
     {
          if(b>c)
          {
               printf("b = %d is Greater", b);
          }
          else
          {
               printf("c = %d is Greater", c);
          }
     }
     return 0;
}


Output:

greatest among three