Tester l'algorithme :
Graphique :
Code de l'algorithme :
1
VARIABLES
2
d EST_DU_TYPE NOMBRE
3
n EST_DU_TYPE NOMBRE
4
p EST_DU_TYPE NOMBRE
5
f EST_DU_TYPE NOMBRE
6
DEBUT_ALGORITHME
7
p PREND_LA_VALEUR 0
8
POUR n ALLANT_DE 1 A 1000
9
DEBUT_POUR
10
d PREND_LA_VALEUR random()
11
SI (d<=0.5) ALORS
12
DEBUT_SI
13
p PREND_LA_VALEUR p+1
14
FIN_SI
15
FIN_POUR
16
AFFICHER "Le nombre de pile obtenus est :"
17
AFFICHER p
18
f PREND_LA_VALEUR p/1000*100
19
AFFICHER "La fréquence (en %) de pile obtenus est :"
20
AFFICHER f
21
FIN_ALGORITHME