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       x EST_DU_TYPE NOMBRE
3       y EST_DU_TYPE NOMBRE
4       N EST_DU_TYPE NOMBRE
5       NbPointsTraces EST_DU_TYPE NOMBRE
6       Proportion EST_DU_TYPE NOMBRE
7       maxN EST_DU_TYPE NOMBRE
8     DEBUT_ALGORITHME
9       LIRE maxN
10      POUR N ALLANT_DE 1 A maxN
11        DEBUT_POUR
12        x PREND_LA_VALEUR 13   random()
14        y PREND_LA_VALEUR 15   random()
16        SI (y==sqrt(1-x*x)) ALORS
17          DEBUT_SI
18          TRACER_POINT (x,y)
19          NbPointsTraces PREND_LA_VALEUR NbPointsTraces+1
20          FIN_SI
21        FIN_POUR
22      AFFICHER "Nombre de points tracés : "
23      AFFICHER NbPointsTraces
24      Proportion PREND_LA_VALEUR NbPointsTraces/maxN
25      AFFICHER "Porportion de points tracés : "
26      AFFICHER Proportion
27    FIN_ALGORITHME