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));
Answers
Answered by
3
Answer:
x = 2.9, y = 2.5
Math.min (Math.floor (x), y )
= Math.min (Math.floor (2.9), 2.5) )
= Math.min (2.0, 2.5)
= 2.0
Math.min (Math.ceil (x), y )
= Math.min (Math.ceil (2.9), 2.5) )
= Math.min (3.0, 2.5)
= 3.0
Similar questions
Environmental Sciences,
1 month ago
Science,
3 months ago
Science,
10 months ago
Sociology,
10 months ago