WHAT'S NEW?
Loading...

SMP S4 : ( Algorithme ) Corrigé de l'exercice 9 de la Serie 1




Pour savoir comment travailler avec cet algorithme Click ici AlgoBox
AlgoBox : sanstitre
FSSM
SMP S4
TP programmation
Serie 1
Exercice 9
Tester l'algorithme
Cliquer sur ce bouton pour exécuter l'algorithme : 
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     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      SI (b==0) ALORS
15        DEBUT_SI
16        SI (c==0) ALORS
17          DEBUT_SI
18          AFFICHER "La solution est l'ensemble R"
19          FIN_SI
20          SINON
21            DEBUT_SINON
22            AFFICHER "Impossible"
23            FIN_SINON
24        FIN_SI
25        SINON
26          DEBUT_SINON
27          x1 PREND_LA_VALEUR -c/b
28          AFFICHER "La solution est: X="
29          AFFICHER x1
30          FIN_SINON
31      FIN_SI
32      SINON
33        DEBUT_SINON
34        delta PREND_LA_VALEUR b*b-4*a*c
35        SI (delta>0) ALORS
36          DEBUT_SI
37          x1 PREND_LA_VALEUR (-b+sqrt(delta))/(2*a)
38          x2 PREND_LA_VALEUR (-b-sqrt(delta))/(2*a)
39          AFFICHER "Les solutions de l'equation sont:"
40          AFFICHER "X1="
41          AFFICHER x1
42          AFFICHER "X2="
43          AFFICHER x2
44          FIN_SI
45          SINON
46            DEBUT_SINON
47            SI (delta<0) ALORS
48              DEBUT_SI
49              AFFICHER "Pas de solutions réels"
50              FIN_SI
51              SINON
52                DEBUT_SINON
53                x1 PREND_LA_VALEUR -b/(2*a)
54                AFFICHER "La solution unique de l'equation est: X="
55                AFFICHER x1
56                FIN_SINON
57            FIN_SINON
58        FIN_SINON
59  FIN_ALGORITHME



0 comments:

Post a Comment