Floor And Ceiling In Java Example
Chapter:
Math Class
Last Updated:
05-05-2016 18:50:24 UTC
Program:
/* ............... START ............... */
public class JavaFloorCeiling {
public static void main(String args[]) {
double x = 7.5;
double y = -8.4;
System.out.println("Math.floor(x) : " + Math.floor(x));
System.out.println("Math.ceil(x) : " + Math.ceil(x));
System.out.println("Math.floor(y) : " + Math.floor(y));
System.out.println("Math.ceil(y) : " + Math.ceil(y));
}
}
/* ............... END ............... */
Output
Math.floor(x) : 7.0
Math.ceil(x) : 8.0
Math.floor(y) : -9.0
Math.ceil(y) : -8.0
Tags
Floor And Ceiling, Java, Math