If you really like the
C
ternary operator, the try
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,max;
printf("enter first integer\n");
scanf("%d", &a);
printf("enter second integer\n");
scanf("%d", &b);
printf("enter third integer\n");
scanf("%d", &c);
max = a > b ? ((a > c) ? a : c) : ((b > c) ? b : c);
printf("%d\n", max);
return 0;
}
However, for the sake of clarity, I would suggest you to use the
if...else statement[
^].