77.3k views
5 votes
What is Math.ceil(3.6)?
A. 3.0
B. 3
C. 4.0
D. 5.0

User Carvellis
by
7.2k points

1 Answer

2 votes

Answer: 4.0 (choice C)

Reason

"ceil" refers to "ceiling". The ceiling function rounds up to the nearest whole number. The value 3.6 naturally rounds to 4 without needing a ceiling function.

Something like 3.1 and 3.01 and 3.001 will all round to 4 when applying the ceiling function. It doesn't matter how close they are to 3; we always round up.

User Gonki
by
7.6k points