Tester l'algorithme :


(cliquer sur le bouton ci-dessus pour lancer ou relancer l'exécution de l'algorithme)
Remarque : si les messages "Algorithme lancé" et "Algorithme terminé" n'apparaissent pas au bout d'un moment dans la zone ci-dessous, c'est que l'algorithme contient une erreur.

Résultats :

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       d EST_DU_TYPE NOMBRE
6       x EST_DU_TYPE NOMBRE
7       y EST_DU_TYPE NOMBRE
8     DEBUT_ALGORITHME
9       AFFICHER "On note : ax² + bx + c"
10      AFFICHER "a = "
11      LIRE a
12      AFFICHER a
13      AFFICHER "b = "
14      LIRE b
15      AFFICHER b
16      AFFICHER "c = "
17      LIRE c
18      AFFICHER c
19      d PREND_LA_VALEUR pow(b,2)-4*a*c
20      AFFICHER "Le discriminant est : "
21      AFFICHER d
22      SI (d<0) ALORS
23        DEBUT_SI
24        AFFICHER "Delta est négatif, le trinôme n'a pas de racine réelle"
25        FIN_SI
26        SINON
27          DEBUT_SINON
28          SI (d==0) ALORS
29            DEBUT_SI
30            AFFICHER "Le trinôme a une racine double : "
31            x PREND_LA_VALEUR -b/(2*a)
32            AFFICHER x
33            FIN_SI
34            SINON
35              DEBUT_SINON
36              AFFICHER "Le trinôme a deux racines distincts : x1 = "
37              x PREND_LA_VALEUR (-b-sqrt(d))/(2*a)
38              AFFICHER x
39              AFFICHER " et x2 = "
40              y PREND_LA_VALEUR (-b+sqrt(d))/(2*a)
41              AFFICHER y
42              FIN_SINON
43          FIN_SINON
44    FIN_ALGORITHME