Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define TAILLE_MAX 1000 // La taille maximale
- int main()
- {
- int tab[TAILLE_MAX], freq[TAILLE_MAX];
- int N, i, j, count;
- /* Saisir la taille actuelle du tableau < TAILLE_MAX */
- printf("Saisir le nombre d'éléments : ");
- scanf("%d", &N);
- /* Saisir les éléments du tableau tab */
- for(i=0; i<N; i++)
- {
- printf("Elément %d ", i+1);
- scanf("%d", &tab[i]);
- }
- /* Trouver la fréquence de chaque élément */
- for (int a=0;a<N;a++)
- {
- freq[tab[a]]=0;
- }
- for (int a=0;a<N;a++)
- {
- freq[tab[a]]++;
- }
- /* afficher tous les éléments uniques du tableau */
- for(i=0; i<N; i++)
- {
- if(freq[tab[i]] == 1)
- {
- printf("%d ", tab[i]);
- }
- }
- }
Add Comment
Please, Sign In to add comment