In this tutorial, we are going to learn writing java program to calculate the square root of a given number.
Our Program will take a number from the users as an input, and will return the square root of that number as output.
What is Square root of Number?
Square root can be defined as a factor of a number that, when multiplied by itself, gives the original number.
2 is a square root of 4. -2 is also a square root of 4.
because 2*2 = 4 and -2 * -2 = 4
Java Program to calculate square root of number
For input 25, the output generated by our program is math.sqrt(25.0) which is equal to 5.00.