Présentation de l'algorithme :
Solutions de l'équation du second degré ax^2+bx+c=0
Tester l'algorithme :
Graphique :
Code de l'algorithme :
1
VARIABLES
2
a EST_DU_TYPE NOMBRE
3
b EST_DU_TYPE NOMBRE
4
c EST_DU_TYPE NOMBRE
5
delta EST_DU_TYPE NOMBRE
6
x1 EST_DU_TYPE NOMBRE
7
x2 EST_DU_TYPE NOMBRE
8
DEBUT_ALGORITHME
9
LIRE a
10
LIRE b
11
LIRE c
12
SI (a!=0) ALORS
13
DEBUT_SI
14
delta PREND_LA_VALEUR b*b-4*a*c
15
SI (delta<0) ALORS
16
DEBUT_SI
17
AFFICHER "Pas de racines réelles"
18
FIN_SI
19
SI (delta==0) ALORS
20
DEBUT_SI
21
x1 PREND_LA_VALEUR -b/(2*a)
22
AFFICHER "Une racine double : "
23
AFFICHER x1
24
FIN_SI
25
SI (delta>0) ALORS
26
DEBUT_SI
27
x1 PREND_LA_VALEUR (-b-sqrt(delta))/(2*a)
28
x2 PREND_LA_VALEUR (-b+sqrt(delta))/(2*a)
29
AFFICHER "Première racine : "
30
AFFICHER x1
31
AFFICHER "Deuxième racine : "
32
AFFICHER x2
33
FIN_SI
34
FIN_SI
35
SINON
36
DEBUT_SINON
37
AFFICHER "Pas du second degré"
38
FIN_SINON
39
FIN_ALGORITHME