Integer x = 34.54, y = 20, z = -5 print ( y > 50 AND z > 10 or x > 30 )?

1

1 Answers

Oddman Profile
Oddman answered
(20 > 50) and (-5 > 10) or (34.54 > 30)
  = False and False or True
  = False or True
  = True
Use of parentheses would eliminate the ambiguity with regard to the order of evaluation of the logical expression.
thanked the writer.
View all 4 Comments
Arpitha B.S
Arpitha B.S commented
The options given foe this was
1.0
2.1
3.-1
4.10
what do u think the answer will be
Oddman
Oddman commented
1 or -1, depending on the value your compiler uses for "true".
Oddman
Oddman commented
If the language is C, the value is likely 1.

Answer Question

Anonymous