Computer Applications
Answer
Math.ceil( ) | Math.floor( ) |
---|---|
Returns the smallest double value that is greater than or equal to the argument and is equal to a mathematical integer | Returns the largest double value that is less than or equal to the argument and is equal to a mathematical integer. |
double a = Math.ceil(65.5); In this example, a will be assigned the value of 66.0 as it is the smallest integer greater than 65.5. | double b = Math.floor(65.5); In this example, b will be assigned the value of 65.0 as it is the largest integer smaller than 65.5. |
Related Questions
Explain the following function:
Math.cbrt()
Explain the following function:
Math.log()
Distinguish between Math.rint() and Math.round()
Write a program to calculate the value of the given expression:
1/a2 + 2/b2 + 3/c2
Take the values of a, b and c as input from the console. Finally, display the result of the expression to its nearest whole number.