Corrigée d’exercice 25
******** En Algorithme ********
Algorithme Moyenne_Notes 
Variables Notes[10], S :réels 
i :entier 
Debut
      S ← 0
 pour i de
1 jusqu'à 10 faire 
       Lire
(Notes[i])
            
 S ← S + Notes[i]
 FinPour
 Ecrire
("La moyenne est:",S/10) 
Fin
 Résultat => 2 6 6 7
5 6 1 0 7 1
                  La moyenne est: 4,1
 
*******En
C***********
#include <stdio.h> 
int main(){ 
float
notes[10],Som=0;
 int i ;
 for( i=0; i < 10; i++){ 
printf("Entrer
un entier:"); 
scanf("%f",¬es[i]);
Som =
Som + notes[i]; 
}
 printf("La moyenne est:%f",Som/10);
 return 0; 
}
******** En C++
********
#include <iostream>
 using namespace std; 
int main(){ 
float notes[10],Som=0;
 int i;
 for( i=0; i<10; i++){ 
cout<<"Entrer
un entier:"; cin>>notes[i];
 Som = Som + notes[i]; 
}
 cout<<"La
moyenne est "<<Som/10;
return 0;
 }

تعليقات
إرسال تعليق