Thursday, July 30, 2009

remove duplicates from given list of numbers

#include
#include
void main()
{
int a[10],n,i,j; clrscr();
printf("\nEnter the num of elements in the array:");
scanf("%d",&n);
printf("\nEnter the elements into the array");
flushall();
for(i=0;i {
scanf("%d",a[i]);
for(j=0;j{ if(a[i]==a[j])
{ i--;
n--;
}
}
}
printf("\nThe elements in array without duplicates are:");

for(i=0;iprintf("%d ",a[i]);
getch();
}

No comments:

Post a Comment