CodePudding user response:
# include# include
Void the sort (int * a, int len)
{
Int I, j, temp.
for(i=0; I
For (j=I + 1; j
If (a [I] & gt; A [j])
{
Temp=a, [I].
a[i]=a[j];
A [j]=temp;
}
}
}
}
Int the find (int * a, int len, int n)
{
int i;
for (i=0; I
If (n==a [I])
{
return i+1;
}
}
return -1;
}
Void main ()
{
[10] int a, b, I;
Printf (" please enter the number 10: \ n ");
for (i=0; I<10; I++)
{
The scanf (" % d ", & amp; A [I]);
}
Sort (a, 10);
for (i=0; I<10; I++)
{
Printf (" % d ", a [I]);
}
Printf (" \ n to enter to search: \ n ");
The scanf (" % d ", & amp; B);
Int n=find (10, a, b);
If (1==I)
{
Printf (" this number cannot be found!" );
return;
}
Printf (" % d in the first % d \ n ", b, n);
}