Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Question2()
- {
- double math;
- String s;
- Scanner sqrt = new Scanner(System.in);
- do
- {
- System.out.print("Enter a number: ");
- math = sqrt.nextDouble();
- System.out.println("The square root of "+math+ " is "+Math.sqrt(math));
- System.out.println("The cube root of "+math+" is "+Math.cbrt(math));
- System.out.println("The square of "+math+" is "+Math.pow(math,2));
- System.out.println("the cube of "+math+" is "+Math.pow(math, 3));
- System.out.println("Input another number? `y` / `n`");
- s = sqrt.next();
- }
- while (s == "y");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement