Algorithme Resolution_equation_second_degre { variable a, b, c, x1,x2, Delta : réel Afficher("Cet algorithme calcule les solutions de l'équation a*x^2+b*x+c=0\n") Afficher("Entrez a : ") Saisir(a) Afficher("Entrez b : ") Saisir(b) Afficher("Entrez c : ") Saisir(c) Si (a = 0) alors { // on est dans le cas d'une équation du premier degré Si (b = 0) alors { Si (c = 0) alors { Afficher("Resultat: infinite de solutions\n") } sinon { Afficher("Resultat: aucune solution\n") } } sinon { x1 <-- -c / b Afficher("Resultat: x =",x1,"\n") } } sinon { // On est dans le cas d'une VRAIE equation du second degré Delta <-- b*b - 4*a*c Si (Delta < 0) alors { Afficher("Resultat: aucune racine réelle\n") } sinon { Si (Delta = 0) alors { x1 <-- -b /(2*a) Afficher("Une racine réelle ",x1,"\n") } sinon { x1 <-- (- b - racine_carre(Delta))/(2*a) x2 <-- (- b + racine_carre(Delta))/(2*a) Afficher("Il y a deux racines réelles ",x1," et ", x2,"\n") } } } }