Predict the output: [2]
double a = 2.00;
double b = - 13.5;
System.out.println(Math.ceil(a) + Math.abs(Math.floor(b)));
Answers
Answer:
16.0
Explanation:
output is :
Math.ceil(a) => Math.ceil(2.00) => 2.0.......(i)
Math.abs(Math.floor(b)) =>Math.abs(Math.floor(-13.5))
Math.floor(-13.5 [which is the value of b]) = -14
Math.abs(-14) = 14.0......(ii)
so , from equation (i) and (ii),
System.out.println(Math.ceil(a) + Math.abs(Math.floor(b)));
[System.out.println(2+14); => 16]
Here are the functions of the all methods :
abs Returns the absolute value of the argument.
round Returns the closed int or long (as per the argument.
ceil Returns the smallest integer that is greater than or equal to the argument.
floor Returns the largest integer that is less than or equal to the argument.
min Returns the smallest of the two arguments.
max Returns the largest of the two arguments.
hope it helps!
plz mark me as brainliest!
your answer is 16.0 .
output is 16.0 .