+ 2

What is the output

a=10; b=20; a==b?cout<<"are not equal":(b>a?cout<<a:cout<<b);

17th Aug 2018, 11:01 AM
Vinodha kumara L
Vinodha kumara L - avatar
5 Answers
0
V1nod Data it's ternary operator...( condition) ? (code to be executed if condition is passed) : (code if condition is failed) and this cab be nested as well as per question code..
17th Aug 2018, 12:17 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 2
tq u
7th Oct 2018, 11:32 AM
Vinodha kumara L
Vinodha kumara L - avatar
+ 1
V1nod try and check it on code playground... feel free to ask if you get doubt
17th Aug 2018, 11:36 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Your first cout should say "are equal", since the first statement is executed if the condition is true
17th Aug 2018, 12:35 PM
Matthias
Matthias - avatar
0
output is 10, however im not sure you can use cout in that question mark thingy
17th Aug 2018, 11:40 AM
Data
Data - avatar