+ 3
Why is Math.ceil function malfunctioning in code coach section...
Java Math.ceil not working in code coach section.Why!!
11 Antworten
+ 1
Aaron
Yes. It return double value.
What result you need?
Integer? Use type cast
(int)Math.ceil(5.0/2);
//3 answer.
+ 2
Jayakrishna🇮🇳 but math.ceil returns a double ...
+ 2
xᴏᴊɪᴀᴋʙᴀʀ Thanks..it's working
+ 2
Jayakrishna🇮🇳 please refer a code...
+ 1
xᴏᴊɪᴀᴋʙᴀʀ in Java it's Math.floor for nearest small... Math.ceil for nearest big number
+ 1
Thanks Jayakrishna🇮🇳 ... Math.ceil requires double parameters
+ 1
Aaron
Just mathematics
0
Can we see the code or snippet?
0
Aaron
5/2 result 2 because both integers. If you want to get decimal point value, you need to have atleast one float or double value.. as
5.0/2 or 5/2.0 then you get 2.5 result, ceil(2.5) =3.0, you will get....
Hope it helps...