33 lines
686 B
C
33 lines
686 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<string.h>
|
||
|
|
||
|
char* getDay(int i) {
|
||
|
if (i == 0) return "lundi";
|
||
|
else if (i == 1) return "mardi";
|
||
|
else if (i == 2) return "mercredi";
|
||
|
else if (i == 3) return "jeudi";
|
||
|
else if (i == 4) return "vendredi";
|
||
|
else if (i == 5) return "samedi";
|
||
|
else if (i == 6) return "dimanche";
|
||
|
else return "???";
|
||
|
}
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
|
||
|
int visiteurs = 0;
|
||
|
|
||
|
for (int i = 0; i < 7; i++) {
|
||
|
printf("Visiteurs le %s : ", getDay(i));
|
||
|
int x; scanf("%d", &x);
|
||
|
|
||
|
visiteurs += x;
|
||
|
}
|
||
|
|
||
|
float avgVisiteur = visiteurs/7.0f;
|
||
|
|
||
|
printf("Il y a en moyenne %f visiteur%s par jour.\n", avgVisiteur, avgVisiteur > 1 ? "s" : "");
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|