0

Can anyone suggest efficient code than this

https://code.sololearn.com/cL5RlJhElVcS/?ref=app

10th Sep 2019, 5:25 AM
kiran kumar
kiran kumar - avatar
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.
10th Sep 2019, 5:33 AM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar