SHARE
TWEET

Untitled

a guest Sep 15th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. double a = 1.23;
  2. double b = 5.67;
  3. double c = -0.12;
  4. double d = -7.89;
  5.  
  6. System.out.println("対象 : " + a);
  7. System.out.println("切り上げ : " + Math.ceil(a));
  8. System.out.println("切り捨て : " + Math.floor(a));
  9. System.out.println("四捨五入 : " + Math.round(a));
  10.  
  11. System.out.println("対象 : " + b);
  12. System.out.println("切り上げ : " + Math.ceil(b));
  13. System.out.println("切り捨て : " + Math.floor(b));
  14. System.out.println("四捨五入 : " + Math.round(b));
  15.  
  16. System.out.println("対象 : " + c);
  17. System.out.println("切り上げ : " + Math.ceil(c));
  18. System.out.println("切り捨て : " + Math.floor(c));
  19. System.out.println("四捨五入 : " + Math.round(c));
  20.  
  21. System.out.println("「" + d + "」に対して");
  22. System.out.println("切り上げ「" + Math.ceil(d) + "」");
  23. System.out.println("切り捨て「" + Math.floor(d) + "」");
  24. System.out.println("四捨五入「" + Math.round(d) + "」");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top