liyaahbear2068 liyaahbear2068
  • 02-09-2019
  • Computers and Technology
contestada

What is the result of expression 15 > 10 > 5 in C? What is the result of the same expression in Java?

Respuesta :

oscarporras02
oscarporras02 oscarporras02
  • 07-09-2019

Answer:

java: error

C: false

Explanation:

In Java the compiler understand that you are trying to compare an integer (15) with a boolean (10 > 5) this generate the next error:

error: bad operand types for binary operator  

In C the compiler convert (15 > 10 > 5) in (15>10) > (10>5) which is equal to TRUE > TRUE, the compiler can also read it as 1 > 1 (since 1 is TRUE and 0 is FALSE).  like 1>1 is false then C program return false.

Answer Link

Otras preguntas

Which has a higher resistance, a 25 W lightbulb or a 50 W bulb?
In which gesture do you move two fingers apart?A. double-upB. slideC. stretchD. press and hold
Answer this PLEASE, answer a,b,c
What is 160 blank % of 40
I will mark you as Brainlest if you can answer me this question correctly! Which animal undergoes complete metamorphosis? A: praying mantis B: termites C: gras
How is your guys day? :D
Which expression represents the positive solution of x² = 8?a. √8b. 8/2c. 8(2)d. 8²
what would happen to residents of remote towns in Alaska who contracted the diphtheria disease in1925 if there were no sled dogs
which property of equation is used to solve m-5=15
Gross weight placed on highway by wheels of one axle: a) Axial Load b) Axle Weight c) Tandem Axle d) Wheelbase