0
Primitive Operators question 3
What is the result of the following code? int x = 15; int y = 4; int result = x / y; System.out.println(result); R=3 //Is that real? I mean, I need to have x=12, for the (Result) R=3 //I try to do my best english guys.
2 Respuestas
+ 1
Both operands for division (<x> and <y>) and also <result> are integers, hence integer division operation be at work here. 15 / 4 => 3.75, but since integers do not support fraction, the 0.75 is discarded and results in just 3.
0
For x= 12 and x =13 and x=14 and x=15 result is 3