largest of three, ternary operator
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,r;
a = 10;
b = 5;
c = -1;
r = a>b?(a>c?a:c):(b>c?b:c);
printf("%d\n",r);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,r;
a = 10;
b = 5;
c = -1;
r = a>b?(a>c?a:c):(b>c?b:c);
printf("%d\n",r);
return 0;
}
Comments