Which of the following mathematical methods returns only an integer?
Advertisements
Question
Which of the following mathematical methods returns only an integer?
Options
Math.ceil(n)
Math.sqrt(n)
Math.floor(n)
Math.round(n)
MCQ
Advertisements
Solution
Math.round(n)
Explanation:
This method rounds up/down a supplied decimal value to a whole number. For example, Math.round(5.5) = 6, but Math.round(5.4) = 5.
shaalaa.com
Introduction of Mathematical Library Methods
Is there an error in this question or solution?
