a program to declare, initialise and print one int variable. Also, print the square and cube of the variable. Write an output.
Answers
Answered by
2
import java.util.Scanner;
public class Integer
{
public static void main (String args [])
{
Scanner sc = new Scanner (System.in);
System.out.print ("Enter A Variable : );
int variable = sc.nextInt();
double sqrt = Math.sqrt(variable);
System.out.print ("Square Root : "+sqrt);
double cbrt = Math.cbrt(variable);
System.out.print ("Cube Root : "+cbrt);
sc.close();
}
}
Similar questions