Subject content:
Given a set of data (integer), in the order since the childhood, "
Input format:
Input a set of integers, when the input "999" said input end,
Note: this group of data is not more than 100,
The output format:
Output is sorted in a line as a result, the integers are separated by a single space,
Input the sample:
24 42 59, 62, 96, 97 50 and 59-999
The output sample:
24 and 42 of 59 50 to 59, 62, 96, 97
Time limit: 500 ms memory limit: 31 KB
And this
CodePudding user response:
https://blog.csdn.net/raynorliu/article/details/79482573CodePudding user response:
With the method of the arrayCodePudding user response:
https://blog.csdn.net/qq_40832960/article/details/105527281 has said this blogCodePudding user response:
Do you have a CCodePudding user response:
# include & lt; stdio.h>
Int main (void)
{
100,23,2,99,108,256,12,1024,512,1 int a [10]={};
/*
1. Assume that the first number is the smallest number first, and then began to cycle
Once upon a time in the future to take comparison, find the smallest number, and then they exchange,
*/
Int I, j, temp, min;
for(i=0; i<10; Number of i++)//
{
//round number each time you select assumes that the smallest number
Min=I;
for(j=i+1; J<10; J++)
{
//there are smaller than the assume that the minimum number
//data exchange default is ascending
If (a/min & gt; A [j])
{
Temp=a, [I].
/* found in the inner loop, the minimum exchange to
A, [I]. */
A [I]=a, [j].
A [j]=temp;
}
}
}
for(int i=0; i<10; I++)
{
Printf (" % d \ n ", a [I]);
}
return 0;
}
CodePudding user response:
No matter use, that is,CodePudding user response: