+ 1
Math ceil
Why Math.ceil(3/2) gives 1 and not 2?
1 ответ
+ 5
3/2 results 1 so ceil(1) is 1. (int/int=int)
If you trying to get 1.5 as result then use a double type data like
Math.ceil(3.0/2) ; give 2, because 3.0/2 = 1.5
Why Math.ceil(3/2) gives 1 and not 2?