Advertisement
Josif_tepe

Untitled

Feb 7th, 2022
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main()
  4. {
  5.     int n;
  6.     scanf("%d", &n);
  7.    
  8.     int niza[n];
  9.    
  10.     for(int i = 0; i < n; i++) {
  11.         scanf("%d", &niza[i]);
  12.     }
  13.    
  14.     int frekvencija;
  15.     for(int i = 0; i < n; i++) {
  16.         if(niza[i] != -1) { // dokolku ne sme go ispecatile, togas proveri go
  17.             frekvencija = 1;
  18.             for(int j = i + 1; j < n; j++) {
  19.                 if(niza[i] == niza[j]) {
  20.                     frekvencija++;
  21.                     niza[j] = -1;
  22.                 }
  23.             }
  24.             printf("Frekvencija na %d = %d\n", niza[i], frekvencija);
  25.             niza[i] = -1;
  26.         }
  27.     }
  28.    
  29.    
  30.     return 0;
  31. }
  32. // 5 10 2 5 50 5 10 1 2 2
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement