For floor function

We can write -7.4 as -7.0 only know

Can u pls say how it will be -8

We can write -7.4 as -7.0 only know

Can u pls say how it will be -8

Dark Mode

6 votes

Find the output of the following Java code line

System.out.printIn(math.floor(-7.4))

- -7
- -8
- -7.4
- -7.0

Floor is a function in java which returns the lower limit. Here -8 is lower limit to -7.4 and the higher limit would be -7.

If you represent these numbers on the number line you would have -7 approaching towards zero and -8 away from 7.4 and far from zero so the lower limit would be -8.

Hence the answer is **-8.**

2