Saturday, 27 October 2018

square root of number in java Example | sqrt() function in java

/* java program to find square root of a Number */
class MathDemo{
public static void main(String args[]){

// values for square root
double a = 144;
double b = 9;

//result of square root
System.out.println("\nSquare root of 144 is : "+Math.sqrt(a));
System.out.println("\n Squre root of 9 is : "+Math.sqrt(b));

}
}

o/p
Square root of 144 is :12
Square root of 9 is : 3

No comments:

Post a Comment

JTable Hide and Show in Java Swing