Problem Description
给你N(N<=100)个数,请你按照从小到大的顺序输出。
Input
输入数据第一行是一个正整数N,第二行有N个整数。
Output
输出一行,从小到大输出这N个数,中间用空格隔开。
Example Input
5
1 4 3 2 5
Example Output
1 2 3 4 5
#include<stdio.h>
int main()
{
int a[10],b[10];
int t,i,j,n=10;
for(i=0; i<10; i++)
{
scanf("%d",&a[i]);
b[i]=i+1; \\对应储存位置
}
for(j=1; j<10; j++)
{
for(i=0; i<10-j; i++)
{
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
t=b[i];
b[i]=b[i+1];
b[i+1]=t;
} \\同时交换,仍然对应
}
for(i=0; i<9; i++)
{
printf("%d ",a[i]);
}
printf("%d\n",a[i]);
for(i=0; i<9; i++)
{
printf("%d ",b[i]);
}
printf("%d\n",b[i]);
return 0;
}