Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. main()
  4. {
  5. int n, a[10], b[10], count = 0, c, d;
  6.  
  7. printf("Enter number of elements in array\n");
  8. scanf("%d",&n);
  9.  
  10. printf("Enter %d integers\n", n);
  11. for(c=0;c<n;c++)
  12. scanf("%d",&a[c]);
  13.  
  14. for(c=0;c<n;c++)
  15. {
  16. for(d=0;d<count;d++)
  17. {
  18. if(a[c]==b[d])
  19. break;
  20. }
  21. if(d==count)
  22. {
  23. b[count] = a[c];
  24. count++;
  25. }
  26. }
  27.  
  28. printf("Array obtained after removing duplicate elements\n");
  29. for(c=0;c<count;c++)
  30. printf("%d\n",b[c]);
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement