1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include<stdlib.h>
#include<stdio.h>
int main(){
int nbnotes,nbeleves, i=0, j=0;
float note=0;
float temp=0;
scanf("%d",&nbeleves);
fflush(stdin);
int tab_nbnotes[nbeleves];
float tab_notes[nbeleves][100];
float tab_moys[nbeleves];
while (note != -1) {
scanf("%f",¬e);
fflush(stdin);
if (note < 0){
tab_notes[j][i] = note;
}
i++;
}
i=0;
tab_nbnotes[j]=0;
for(i=0;i<=100;i++){
if(tab_notes[j][i] > 0){
tab_nbnotes[j]++;
}
}
for(i=0;i<=100;i++){
temp = temp + tab_notes[j][i];
}
tab_moys[j] = temp/tab_nbnotes[j];
printf("La moyenne de l'eleve %d est %f",j,tab_moys[j]);
system("PAUSE");
return 0;
} |
Partager