Algorithme Racine_carre { variable y, X, epsilon, abs : réel reponse : caractere Repeter { Afficher("Cet algorithme calcule une approximation de racine carrée de X.\n") Repeter { Afficher("Veuillez saisir X") Saisir(X) } jusqu'à ( X >= 0) Repeter { Afficher("Veuillez saisir la precision souhaitée") Saisir(epsilon) } jusqu'à (epsilon >= 0) y <-- 1 Repeter { y <-- 1/2*(X/y+y) abs <-- (x-y*y) Si (abs< 0) alors { abs <-- - abs } } jusqu'à ( abs < epsilon) // **************** Avec un tant que ***************** // abs <-- (x-y*y) // Si (abs< 0) alors // { // abs <-- - abs // } // // Tant que (abs >= epsilon) // { // y <-- 1/2*(X/y+y) // abs <-- (x-y*y) // Si (abs< 0) alors // { // abs <-- - abs // } // } Afficher("Racine_carrée(",X,")=",y,"\n") Afficher("Voulez vous recommencer ? (O/N)") Saisir(reponse) } jusqu'à (reponse='N') }