+ 1

Primitive Operators

The question on this part of java says 15/4 which would = 3.75 meaning it would round up to 4 but the answer is 3 any reason why this is?

27th May 2017, 10:52 PM
throwawayaccount123
2 Respostas
+ 3
ints don't round, they truncate.
27th May 2017, 11:20 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
Why do you think it should? When you divide integers, the remainder is simply discarded.
27th May 2017, 11:02 PM
1of3
1of3 - avatar