Computer Applications

What will be the output of Math.floor(-20.10);?

  1. -20.0
  2. -21.0
  3. 20
  4. 21

Java Math Lib Methods

5 Likes

Answer

-21.0

Reason — Math.floor() method returns the largest double value that is less than or equal to the argument and is equal to a mathematical integer. Thus, -21.0 is returned by Math.floor(-20.10); method.

Answered By

2 Likes


Related Questions