0
i stuck in a quiz, pls help
What is the result of the following code? int x = 15; int y = 4; int result = x / y; System.out.println(result);
2 Respuestas
+ 2
It's 3
Because 15 / 4 = 3 rem 3 but it's rounded down
0
Since both data types are integer, you will get an integer result instead of floating point number. If you wanna get that desired number, use 15 / 4.0 or 15.0 / 4.0