+ 2
If((!0 && 2) || (!1)) EXPLANATION(C)
Can somebody explain this question .tq If((!0 && 2) || (!1)){ printf("true"); } Else{ Print("false"); }
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?
+ 3
Itâs a boolean conditions
Itâs like as
If((!false && true) || (!true))
Then
If((true&&true) || (false))
Finally
If(true || false)
+ 3
true
+ 2
is it true??
+ 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.
+ 2
Thanks everyone for helping
+ 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
+ 1
Which part of these is confusing you if I may ask?
+ 1
The whole if statement...đI don't even understand how !0 && 2 will have an answer
0
Yup
0
True