#include <stdio.h>
int main(void)
{
int number[10];
int i,j,temp;
printf("Please input 10 numbers:\n");
for(i = 0; i < 10; i++)
scanf("%d",&number[i]);
for(i = 0; i < 10; i++)
for(j = 0; j < 10-i-1; j++)
if(number[j] > number[j+1])
{
temp = number[j];
number[j] = number[j+1];
number[j+1] = temp;
}
printf("The sorted numbers:\n");
for(i = 0; i < 10; i++)
printf("%d ",number[i]);
printf("\n");
return 0;
} |
|