I need to calculate the square root of an entered number by a manual calculation with the constant EPSILON as long as (x2 - a) > EPSILON
. What is wrong with my code?
import java.util.Scanner;
import java.lang.Math;
public class ProgrammeRacineCarree
{
public static Scanner clavier = new Scanner(System.in);
public static void main(String[] args){
System.out.print("\f");
double a = clavier.nextInt();
double x = a;
double xadeux = java.lang.Math.pow(x,2);
double epsilon = 0.0001;
while((xadeux-a)>epsilon){
x = (x/2)+(a/(2*x));
}
System.out.println("La valeur de la racine carrée de " + a + " est de " + x + " .");
}
}