#include
#define N 10
int main()
{
int i,j,t;
int a[N]={6,2,4,1,5,9,0,8,7,3}; //n个元素
for(j=0;j{ for (i=0;i if (a[i]>a[i+1]) //每次比较相信的二个数,若大小顺序不对,就交换它们相互位置
{t=a[i];
a[i]=a[i+1];
a[i+1]=t;}
}
for(i=0;iprintf("%d ",a[i]);
printf("\n");
return 0;
}
#include
#define N 10
int main()
{
int i,j,t;
int a[N]={6,2,4,1,5,9,0,8,7,3}; //n个元素
for(j=0;j{ for (i=0;i if (a[i]>a[i+1]) //每次比较相信的二个数,若大小顺序不对,就交换它们相互位置
{t=a[i];
a[i]=a[i+1];
a[i+1]=t;}
}
for(i=0;iprintf("%d ",a[i]);
printf("\n");
return 0;
}