C program to find greatest of three numbers using ternary operator

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,x;
puts("Enter the first number");
scanf("%d",&a);
puts("Enter the second number");
scanf("%d",&b);
puts("Enter the third number");
scanf("%d",&c);
x=a>b?(a>c?a:c):(b>c?b:c);
printf("Greatest number is %d",x);
}

Comments