26 lines
334 B
C
26 lines
334 B
C
|
#include <stdio.h>
|
||
|
|
||
|
#define N 10
|
||
|
|
||
|
int main () {
|
||
|
|
||
|
int T[N] = {5,1,2,2,1,3,2,3,2,1};
|
||
|
|
||
|
int cible = 2 ;
|
||
|
|
||
|
int compteur = 0 ;
|
||
|
|
||
|
int i ;
|
||
|
|
||
|
for (i = 0 ; i< N ; i++) {
|
||
|
if (T[i] == cible)
|
||
|
{
|
||
|
compteur = compteur + 1 ;
|
||
|
}
|
||
|
}
|
||
|
printf("Cible (%d) apparait %d fois \n",cible,compteur);
|
||
|
|
||
|
|
||
|
return 1;
|
||
|
}
|