Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main ()
- {
- setbuf(stdout, NULL);
- int nums[20] , i , j, k;
- int count=0;
- {
- printf("Enter integers. (Negative -1 to stop):\n");
- for (i=0; i < count; i++)
- {
- scanf("%d", &nums[i]);
- count = count +1;
- if(nums[i] == -1 )
- break;
- }
- }
- printf("The numbers you entered are:\n");
- for(i=1;i<count;++i)
- {
- printf("%d\n", nums[i-1]);
- }
- printf("\nThe numbers you entered with the duplicate numbers removed:\n ");
- for(i=0;i<count;i++)
- {
- for(j=i+1;j<count;)
- {
- if(nums[j]==nums[i])
- {
- for(k=j;k<count-1;k++){
- nums[k]=nums[k+1];
- }
- count--;
- }
- else
- j++;
- }
- }
- for(i=0;i<count;i++)
- printf("%d\n ",nums[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement