Computer Science, asked by Anonymous, 1 month ago

Give the output of the following program segment:

double x=2.9,y=2.5;
System.out.println(Math.min(Math.floor(x),y));
System.out.println(Math.max(Math.ceil(x),y));

BASED ON JAVA PROGRAMMING

Answer only if you know ! ​

Answers

Answered by steffiaspinno
0

The output of the following program is:

(Math.min(Math.floor(x),y)) = 2.0

(Math.max(Math.ceil(x),y)) = 3.0

The Java.lang.math.max() function is a built-in Java function that returns the maximum of two numbers. The arguments can be int, double, float, or long. If both a negative and a positive number are passed as arguments, the positive result is produced. Math.min and Math.max are used to compare values and keep them within ranges. Math.min can be used in conjunction with array indexes. max and min in math Two numbers are not the same. One is bigger. The other is a lot smaller. We get the larger one when we use Math.max, and the smaller one when we use Math.min.

Similar questions