How to find the floor value of a number using Math.floor() method in Java

1 Answer

0 votes
public class FindTheFloorValueOfANumber_Java {
 
    public static void main(String[] args) {
        System.out.println(Math.floor(50));
 
        System.out.println(Math.floor(50.1));
 
        System.out.println(Math.floor(5.4));
        System.out.println(Math.floor(5.5));
        System.out.println(Math.floor(5.6));
 
        System.out.println(Math.floor(-10));
 
        System.out.println(Math.floor(-13.4));
        System.out.println(Math.floor(-13.5));
        System.out.println(Math.floor(-13.6));
 
        System.out.println(Math.floor(0));
    }
}


    
/*
run:
 
50.0
50.0
5.0
5.0
5.0
-10.0
-14.0
-14.0
-14.0
0.0
   
*/

 



answered Nov 8, 2016 by avibootz
edited Aug 10, 2024 by avibootz
...