Write a program in Java to read a number and display the cube root and
square root of the number.
Answers
Answered by
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
Math,
3 months ago
Math,
6 months ago
Political Science,
6 months ago
Biology,
10 months ago
Computer Science,
10 months ago
English,
10 months ago