Advertisement
mustahidhasan

Untitled

Jun 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include<stdio.h>//solve
  2.  
  3. int main(){
  4.  
  5.     int i, j, c, n;
  6.     printf("How many numbers You want to insert in array..?\n");
  7.     scanf("%d", &n);
  8.     int a[n + 1];
  9.  
  10.     for(i = 0; i < n; i++){
  11.         scanf("%d", &a[i]);
  12.     }
  13.  
  14.     for(i = 0; i < n; i++){
  15.         c = 1;
  16.         for(j = i + 1; j < n; j++){
  17.             if(a[i] == a[j] && a[i] != '\0'){
  18.                 c++;
  19.                 a[j] = '\0';///doing null so that the value don't get selected again during the full loop
  20.             }
  21.  
  22.         }
  23.         if(c > 1 && a[i] != '\0'){
  24.             printf("Repeated Number: %d Frequency: %d\n", a[i], c);
  25.         }
  26.     }
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement