Computer Science, asked by malakumari1507, 3 months ago

2) Math. round(-20.51)=?
a) 20
b) -21
c) 19
d) none​

Answers

Answered by khrushell
0

Answer:

a) 20 cuz it rounds the largest one

Answered by mahinderjeetkaur878
0

The correct answer is (b) -21.

The Math.round() function is used to round a number to the nearest integer. When rounding negative numbers, the rule is to round to the nearest integer that is closer to zero. In this case, -20.51 is closer to -21 than it is to -20, so the rounded result will be -21.

To understand why, let's consider the number line. If we place -20.51 on the number line, we can see that it is closer to -21 than it is to -20. In fact, it is exactly halfway between -20 and -21.

           -22    -21    -20    -19    -18

           |------|------|------|------|

                            -20.51

Since -20.51 is exactly halfway between -20 and -21, the rounding rule is to round to the nearest even integer. However, since both -20 and -21 are odd numbers, we simply round to the nearest integer that is closer to zero, which is -21.

Therefore, the correct answer is (b) -21.

To know more:-

https://brainly.in/question/9903858?referrer=searchResults

https://brainly.in/question/27863643?referrer=searchResults

#SPJ6

Similar questions