DEV/DEV1.1/Entrainements/controle_machine_A/coincidences.c

28 lines
533 B
C
Raw Permalink Normal View History

2024-10-15 12:51:01 +02:00
# include <stdio.h>
# include <stdlib.h>
int main(void) {
int resultats[5];
int i;
int max;
int compteur_occurences;
for (i = 0; i != 5; i++) {
printf("Jet n°%d : ", i+1);
scanf("%d", &resultats[i]);
getchar();
}
max = resultats[0];
for (i = 0; i != 5; i++) {
if (resultats[i] > max) {
max = resultats[i];
}
}
compteur_occurences = 0;
for (i = 0; i != 5; i++) {
if (max == resultats[i]) {
compteur_occurences++;
}
}
printf("Occurences maximum : %d\n", compteur_occurences);
return EXIT_SUCCESS;
}