+ 2

If((!0 && 2) || (!1)) EXPLANATION(C)

Can somebody explain this question .tq If((!0 && 2) || (!1)){ printf("true"); } Else{ Print("false"); }

10th May 2020, 12:25 PM
Burn
Burn - avatar
13 Answers
+ 5
it turns into a bool condition. you can read it as: if ((!false && true) || !true) which is same as writing: if ((true && true) || false) which turns into: if (true || false) you think you understand?
10th May 2020, 1:13 PM
Gen2oo
Gen2oo - avatar
+ 3
It’s a boolean conditions It’s like as If((!false && true) || (!true)) Then If((true&&true) || (false)) Finally If(true || false)
10th May 2020, 2:31 PM
Asrar
Asrar - avatar
+ 3
true
11th May 2020, 5:48 AM
Ashutosh k.
Ashutosh k. - avatar
+ 2
is it true??
10th May 2020, 12:28 PM
durian
durian - avatar
+ 2
!0 is equal to 1 in C any non-zero value is true so (1 && 2) both values are true, which means first condition is true. Your use of logical OR in if-statement means only one of two conditions need to be true for true to be printed. And the first one is.
10th May 2020, 1:03 PM
Gen2oo
Gen2oo - avatar
+ 2
Thanks everyone for helping
10th May 2020, 1:26 PM
Burn
Burn - avatar
+ 2
In if condition If (!0&&2)||!1) Here !0 is true so one condition is true here and u used or if one condition will be true its will give true so answer will be print true
11th May 2020, 8:55 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Which part of these is confusing you if I may ask?
10th May 2020, 12:47 PM
Ipang
+ 1
The whole if statement...😂I don't even understand how !0 && 2 will have an answer
10th May 2020, 1:05 PM
Burn
Burn - avatar
0
Yup
10th May 2020, 12:37 PM
Burn
Burn - avatar
0
True
12th May 2020, 8:43 AM
RAMDEV SARSWAT
RAMDEV SARSWAT - avatar