Developpement/23DEV1.1/CM1/Exo5.c

33 lines
679 B
C

#include <stdio.h>
#include <stdlib.h>
#define NUMEROS 27
int main(void) {
int tableau[5];
int tabinterdit[5];
int indice;
int indice2;
int doublon = 0;
int doublef;
for(indice = 0 ; indice < 5 ; indice++){
printf("Jet n°%d : ", indice+1);
scanf("%d", &tableau[indice]);
}
for(indice = 0 ; indice < 5 ; indice++){
for(indice2 = 0 ; indice2 < 5 ; indice2++){
if(tableau[indice] == tableau[indice2]){
doublon++;
}
}
if(doublon == 2){
doublef++;
tabinterdit[indice] = tableau[indice];
}
doublon = 0;
}
doublef = doublef/2;
printf("Occurrences maximum : %d\n", doublef);
return EXIT_SUCCESS;
}