include<stdio.h#>
#include<conio.h>
main()
{
clrscr();
int a[40],i,n,k,j;
printf("\n enter the size of array:");
scanf("%d",&n);
printf("\n enter the element:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
{
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]==a[j])
{
for(k=j;k<n;k++)
a[k]=a[k+1];
}
}
}
}
n--;
printf("\n after remove duplicate no.\n");
for(i=0;i<n;i++)
{
printf("\n %d\n",a[i]);
}
getch();
return 0;
}
0 comments:
Post a Comment