Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double a = 1.23;
- double b = 5.67;
- double c = -0.12;
- double d = -7.89;
- System.out.println("対象 : " + a);
- System.out.println("切り上げ : " + Math.ceil(a));
- System.out.println("切り捨て : " + Math.floor(a));
- System.out.println("四捨五入 : " + Math.round(a));
- System.out.println("対象 : " + b);
- System.out.println("切り上げ : " + Math.ceil(b));
- System.out.println("切り捨て : " + Math.floor(b));
- System.out.println("四捨五入 : " + Math.round(b));
- System.out.println("対象 : " + c);
- System.out.println("切り上げ : " + Math.ceil(c));
- System.out.println("切り捨て : " + Math.floor(c));
- System.out.println("四捨五入 : " + Math.round(c));
- System.out.println("「" + d + "」に対して");
- System.out.println("切り上げ「" + Math.ceil(d) + "」");
- System.out.println("切り捨て「" + Math.floor(d) + "」");
- System.out.println("四捨五入「" + Math.round(d) + "」");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement