How to print largest number among 3 digits using conditional operator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print largest number among 3 digits using conditional operator?

2nd Aug 2017, 9:14 AM
Aryan Kaushik
Aryan Kaushik - avatar
2 Answers
+ 10
If the first number is larger than the second and third number, print first. If the second number is larger than the first and third number, print second. If the third number is larger than the first and second number, print third.
2nd Aug 2017, 9:17 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
if(a>b && a>c) cout<<"largest="<<a; else if (b>a && b>c) cout<<"largest="<<b; else cout<<"largest="<<c;
2nd Aug 2017, 9:21 AM
P R
P R - avatar