//Compute the square root "by hand" import tio.*; public class SquareRoot { public static void main(String[] args) { System.out.println("Please enter a number:"); double a = Console.in.readDouble(); double xnew = a / 2; double xold; do { xold = xnew; xnew = (xold + a / xold) / 2; System.out.println(xnew); //Test for equality between two doubles } while (Math.abs(xnew - xold) > 1E-4); System.out.println("\nSqrt is: " + xnew); } }