Last Updated: 16 April, 2023
On this page, we are going to learn how to write a Java program to find a number's square root.
The square root of a number is a value that, when multiplied by itself, gives the original number. It is denoted by the symbol √ and can be calculated for any non-negative real number.
For example,
The square root of 9 is 3 because 3 multiplied by itself equals 9 (3 x 3 = 9).
Similarly,
The square root of 16 is 4 because 4 multiplied by itself equals 16 (4 x 4 = 16).
Example 1: Find Number Square Root in Java using Math.sqrt() method
Output
Enter the Number: 64
Square root of number 64.0 is 8.0
Example 2: Find Number Square Root using Math.pow() method
Output
Enter the Number: 36
Square root of number 36.0 is 6.0
Example 3: Find Number Square Root using user defined method
Output
Enter a number: 81
Square root of number 81.0 is: 9.0
That's all guys, hope this Java Program is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com