+ 1

What is the output of the code?

int x = 8; int y=4; if( x>4 || y<3) cout << x+y; else cout << x*y;

2nd Apr 2018, 3:57 PM
✌ RK ✌
✌ RK ✌ - avatar
2 Answers
0
1.) First condition is met (x which is 8 is greater than 4) 2.) Second condition is not even evaluated because of logical or || 3.) Only first if branch is evaluated (output of 8+4 = 12)
2nd Apr 2018, 4:04 PM
Marius Heise
Marius Heise - avatar
+ 3
12
2nd Apr 2018, 4:02 PM
Raj Chhatrala
Raj Chhatrala - avatar