Computer Science, asked by maitysoumasish2005, 5 months ago

value of Math.rint(12.7)​

Answers

Answered by abhisingh76
0

Answer:

•Follow Me

Explanation:

•The Java Math rint() method returns a value that is closest to the specified value and is equal to the mathematical integer.

That is, if the specified value is 5.8, the closest value that is equal to the mathematical integer is 6.0. And, for value 5.4, the closest value that is equal to mathematical integer is 5.0.

The syntax of the rint() method is:

Math.rint(double value)

Note: The rint() method is a static method. Hence, we can call the method directly using the class name Math.

rint() Parameters

arg - argument whose closest value that is equal to mathematical integer is returned

rint() Return Values

returns the closest value to arg that is equal to the mathematical integer

Example: Java Math.rint()

class Main {

public static void main(String[] args) {

// Math.rint()

// value greater than 5 after decimal

System.out.println(Math.rint(1.878)); // 2.0

// value less than 5 after decimal

System.out.println(Math.rint(1.34)); // 1.0

// value equal to 5 after decimal.

Similar questions