Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean sqrRootRecursive(int number, double approx, double tol)
- {
- if( (Math.abs((Math.pow(approx,2) - number))<= tol))
- {
- System.out.println("The root is " +approx);
- }else if (Math.abs((Math.pow(approx,2)-number))>tol)
- {
- sqrRootRecursive(number, ((Math.pow(approx,2)+number)/(2*approx)), tol);
- }
- return true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement