Java Program Ceiling using Math.ceil

Compiled By Unknown - No Comments

Ceiling. With this method, a number is always increased if it has a fractional part. It does not matter how close to the lower number the number is—it is increased by ceil().

Java program that uses Math.ceil

import java.lang.Math;

public class Program {
    public static void main(String[] args) {

 // Compute ceilings of these values.
 double value = Math.ceil(1.1);
 double value2 = Math.ceil(-0.9);

 System.out.println(value);
 System.out.println(value2);
    }
}

Output

2.0
-0.0

Tags:

No Comment to " Java Program Ceiling using Math.ceil "