Résolution de l`équation ax^2+bx+c = 0
Transcription
Résolution de l`équation ax^2+bx+c = 0
ALGOBOX : SECOND_DEGRE(EQUATIONS) PRÉSENTATION DE L'ALGORITHME : Résolution de l'équation ax^2+bx+c = 0 CODE DE L'ALGORITHME : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 VARIABLES a EST_DU_TYPE NOMBRE b EST_DU_TYPE NOMBRE c EST_DU_TYPE NOMBRE d EST_DU_TYPE NOMBRE x0 EST_DU_TYPE NOMBRE x1 EST_DU_TYPE NOMBRE x2 EST_DU_TYPE NOMBRE DEBUT_ALGORITHME AFFICHER "Résolution de l'équation ax^2+bx+c=0" AFFICHER "Donner la valeur de a :" LIRE a AFFICHER "Donner la valeur de b :" LIRE b AFFICHER "Donner la valeur de c :" LIRE c d PREND_LA_VALEUR pow(b,2) - 4*a*c SI (d<0) ALORS DEBUT_SI AFFICHER "Il n'y a pas de solution réelle" FIN_SI SI (d==0) ALORS DEBUT_SI AFFICHER "Il n'y a qu'une seule solution" x0 PREND_LA_VALEUR -b/(2*a) AFFICHER x0 FIN_SI SI (d>0) ALORS DEBUT_SI AFFICHER "Il y a deux solutions :" x1 PREND_LA_VALEUR (-b + sqrt(d))/(2*a) x2 PREND_LA_VALEUR (-b - sqrt(d))/(2*a) AFFICHER x1 AFFICHER x2 FIN_SI FIN_ALGORITHME RÉSULTATS : ***Algorithme lancé*** Résolution de l'équation ax^2+bx+c=0 Donner la valeur de a : Entrer a : 7 Donner la valeur de b : Entrer b : -9 Donner la valeur de c : Entrer c : 1 Il y a deux solutions :1.162865 0.12284929 ***Algorithme terminé*** Généré par AlgoBox
Documents pareils
AlgoBox : Equation cartésienne de droite Cet algorithme permet de
//On affiche les coordonnées des points A et B :
AFFICHER Points
//Abscisse du vecteur AB :
u PREND_LA_VALEUR xB-xA
//Ordonnée du vecteur AB :
v PREND_LA_VALEUR yB-yA
//M(x; y) appartient à (AB) si...
Polynômes du second degré - algorithme pour déterminer les
Algorithme pour déterminer les solutions d'une équation du second degré
On se propose d'écrire un algorithme permettant de déterminer des valeurs
approchées des solutions (éventuelles) d'une équati...