0
Can anyone suggest efficient code than this
2 Answers
+ 3
/*Reduced 2 variables.
Removed stdlib header as it's not necessary here
*/
#include <stdio.h>
int main()
{
long long int a,b,c;
scanf("%d%d%d",&a,&b,&c);
printf("%d\n\n",(a>b)?((a>c)?(a):c):((b>c)?b:c));
return 0;
}
Moreover I'll suggest to use if else statement instead of ternary operators . There is no difference in performance and speed of both. Ternary should be used only if it makes code more readable.
Avoid it if multiple conditions to bd checked.