Kawsar_Hossain

Array Problem 6

Jun 21st, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int a[10],i,j,count=0;
  5.     for (i=0;i<10;i++)
  6.     {
  7.         scanf("%d", &a[i]);
  8.     }
  9.     for (i=0;i<10;i++)
  10.     {
  11.         for(j=i+1;j<10;j++)
  12.         {
  13.             if(a[i]==a[j])
  14.             {
  15.                 count++;
  16.                 break;
  17.             }
  18.         }
  19.     }
  20.     int count2;
  21.     count2=10-count;
  22.     printf("Total number of unique elements=%d", count2);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment