+ 1
Why does this output 0??
I can't figure out how the output becomes 0 in the code below. Can someone please help me out? (C++) int x = 5; cout << (x>5 || (x==5 && x==6 || x<5));
3 Answers
+ 2
x>5=0
(x==5)=1 && (x==6)=0 ..1&&0=0
x<5=0
0||(0||0)=0..
+ 4
Put the value of x in whole expression and see why it giving 0 . Here all conditions are failed so output is 0
+ 2
0 is false and the expression is evaluated as false.