Int a=2, b=4; printf("%d", a||b) ; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Int a=2, b=4; printf("%d", a||b) ;

Find the output?

24th Jan 2019, 2:33 PM
Sanjeev Kumar
Sanjeev Kumar - avatar
2 Answers
+ 3
2 || 4 will yield true, as one of them at least is nonzero, so it will just print the number 1, because true is converted to 1.
24th Jan 2019, 3:24 PM
Bebida Roja
Bebida Roja - avatar
0
output is 1.Because you are using logical OR operator.from the truth table of OR true || true=true.true mean 1.false mean 0.a||b or 2||3 mean true.so that the output is 1.
31st Jan 2019, 3:17 PM
SURESH S
SURESH S - avatar