CodePudding user response:
Reference:# include
Int removeDuplicates (int arr [], int n)
{
Int I, j, flag, curr=1;
For (I=1; I & lt; n; I++) {
flag=1;
For (j=0; J & lt; Curr. J++) {
If (arr [I]==arr [j]) flag=0;//filter duplicate values
}
If (flag) arr [curr++]=arr [I];
}
Return curr.
}
Int main ()
{
Int a, [100].//{66-3,12,11,11,7,8,9,12,7,7,16,8,17};
Int I, n=0;
While (1) {
If (the scanf (" % d ", & amp; A [n])==(EOF) break;//CTRL + z input end of the
n++;
If (n> 99) break;
}
N=removeDuplicates (a, n);//remove duplicate values
for(i=0; iPrintf (" % d % c, "a [I], I==n - 1? '\ n' : ');
return 0;
}