157k views
0 votes
Assume that a, b, and c have been declared and initialized with int values. The expression !(a > b || b <= c) is equivalent to which of the following:

a) -a > b && b <= c
b) -a < b || b >= c
c) -a <= b && b > c
d) -a <= b || b > c

1 Answer

2 votes

The equivalent expression for !(a > b || b <= c) is a <= b && b > c, after applying De Morgan's laws.

The expression !(a > b || b <= c) uses logical NOT (!) and OR (||) operators. To find an equivalent expression without the negation, we need to apply De Morgan's laws. De Morgan's laws state that the negation of a disjunction (a || b) is equivalent to the conjunction of the negations (i.e., !a && !b). Therefore, the negation of a > b || b <= c is a <= b && b > c.

So the expression !(a > b || b <= c) is equivalent to a <= b && b > c. This makes the correct answer to the original question (c) -a <= b && b > c assuming that the minus sign in front of 'a' in the options was a typographical error and not meant to suggest negating the value of 'a'.

User Waruna
by
7.8k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.