Computer Science, asked by donaldtrump12327, 5 months ago

Write a program in Java to read a number and display the cube root and

square root of the number.​

Answers

Answered by anindyaadhikari13
2

Question:-

Write a program in Java to read a number and display the cube root and square root of the number.

Program:-

class Number

{

public static void main(int n)

{

System.out.println("Cube root is: "+Math.cbrt(n));

System.out.println("Square root is: "+Math.sqrt(n));

}

}

These two functions, Math.cbrt() and Math.sqrt() are used to calculate cube root and square root respectively.

Similar questions