Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Day10B {
- public static void main(String[] args) {
- Day10B callMe = new Day10B();
- System.out.println(Math.E);
- System.out.println("square root of 25: " + Math.sqrt(25));
- System.out.println("cube root of 27: " + Math.cbrt(27));
- callMe.testRoundingNumber(0.25);
- callMe.testRoundingNumber(0.5);
- callMe.testRoundingNumber(0.75);
- callMe.testRoundingNumber(10);
- callMe.testRoundingNumber(10.20);
- callMe.testRoundingNumber(10.57);
- }
- void testRoundingNumber(double n1){
- System.out.println("using rint: " + Math.rint(n1));
- System.out.println("using round: " + Math.round(n1));
- System.out.println("using floor: " + Math.floor(n1));
- System.out.println("using ceil: " + Math.ceil(n1));
- System.out.println("- - -\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment