Rutik Vinod Gharat (Problem No. : 03)
import java.util.Scanner;
public class FindSquareRoot {
public static void main(String[] args) {
System.out.print("Enter a number: ");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.printf("%.3f", squareRoot(n));
}
public static double squareRoot(int num) {
double t;
double sqroot = num / 2;
do {
t = sqroot;
sqroot = (t + (num / t)) / 2;
} while ((t - sqroot) != 0);
return sqroot;
}
}