fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double A = scanner.nextDouble();
  8. double B = scanner.nextDouble();
  9.  
  10. double result = A / B;
  11.  
  12. System.out.println("floor " + (int)A + " / " + (int)B + " = " + (long)Math.floor(result));
  13. System.out.println("ceil " + (int)A + " / " + (int)B + " = " + (long)Math.ceil(result));
  14. System.out.println("round " + (int)A + " / " + (int)B + " = " + Math.round(result));
  15.  
  16. scanner.close();
  17. }
  18. }
  19.  
Success #stdin #stdout 0.24s 61196KB
stdin
23
54
stdout
floor 23 / 54 = 0
ceil 23 / 54 = 1
round 23 / 54 = 0