package java_programs;
import java.util.*;

public class SQRT {
    public static double sqrt(double x, double epsilon) {
        double approx = x / 2.0;
        double previousApprox;
        do {
            previousApprox = approx;
            approx = 0.5 * (approx + x / approx);
        } while (Math.abs(approx - previousApprox) > epsilon);
        return approx;
    }
}