xxxxxxxxxx
double squar = Math.pow([value],0.5) // square root of the value
ex :
public class SquareRoot{
public static void main(String []args){
System.out.println(Math.pow (4, 0.5));
}
}
output :
>>2
xxxxxxxxxx
import java.lang.Math;
public class Main {
public static void main(String[] args) {
double number = 16; // Replace 16 with the desired number
double squareRoot = Math.sqrt(number);
System.out.println("Square root of " + number + " is " + squareRoot);
}
}
xxxxxxxxxx
Scanner in=new Scanner(System.in);
int num=in.nextInt();
Systen.out.println(Math.pow(num,0.5));