Java: Compute the square root of a given integer
Square Root Calculation
Write a Java program to compute the square root of a given number.
Pictorial Presentation:
Sample Solution:
Java Code:
Sample Output:
Input a positive integer: 25 Square root of 25 is: 5
Flowchart:
For more Practice: Solve these Related Problems:
- Modify the program to compute the cube root of a number.
- Write a program to compute the square root using the Newton-Raphson method.
- Modify the program to return the integer part of the square root only.
- Write a program to compute the nth root of a number.
Go to:
PREV : FizzBuzz 1 to 100.
NEXT : First Occurrence in String.
Java Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.