Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 3
Why is Math.ceil function malfunctioning in code coach section...
Java Math.ceil not working in code coach section.Why!!
11 Respostas
+ 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...