Assume A holds 1 and B holds 0, then - | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Assume A holds 1 and B holds 0, then -

!(A&&B) is "true" ... Please tell why?

17th Jan 2018, 6:00 PM
Sagar Ambastha
Sagar Ambastha - avatar
5 Answers
+ 5
Simple You said a holds 1 and b holds 0 which means a is true and b is false. now you've given a condition that !(a&&b) which means in English that "neither a nor b should be false" but b is false. Hence finally overall condition is true. Note that computer always takes 0 as a false and numbers greater than 0 as true. hence a is true and b is false.
17th Jan 2018, 6:10 PM
Akash papnai
Akash papnai - avatar
+ 24
A&B are of opposite nature ... so its obvious that A&B will return false only so !(A&&B) will be true
17th Jan 2018, 6:13 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 5
!(A&&B) = !(1&&0) = !(0) // if any of the operands is 0 in AND operation, then it makes the whole expression 0 = 1 (true)
17th Jan 2018, 6:06 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 5
in C "1" is always true. not (A and B ) =>( A or not B ) => ( A or A ) => (1 or 1 )=> ( true or true ) => true . Note : "=>" means implies . hope this helps :).
24th Jun 2018, 9:24 PM
Anon Fox
Anon Fox - avatar
+ 3
(A&&B)is false because b is 0 or one of tem is false (0). but !(logical not operator ) is used to reverse the state so it makes it true
17th Jan 2018, 6:05 PM
Enas Emad
Enas Emad - avatar