Tue, Jun 20, 2017, 08:39:35 AM
by zhimin

#include <stdio.h>
int main()
{
int a[10]={7,8,10,2,4,5,1,0,9,10};
int i,j,t;

for(j=0;j<9;j++)
{
for(i=0;i<9-j;i++)
{
if(a[i]>a[i+1])
{ t=a[i+1];
a[i+1]=a[i];
a[i]=t;
}
}
}

for(i=0;i<10;i++)
printf("%d ",a[i]);
return 0;
}


Tue, Jun 20, 2017, 08:38:58 AM
by zhimin

#include <stdio.h>
int main()
{
int a[10]={7,8,10,2,4,5,1,0,9,10};
int i,j,t;

for(j=0;j<9;i++)
{
for(i=0;i<9-j;i++)
{
if(a[i]>a[i+1])
{ t=a[i+1];
a[i+1]=a[i];
a[i]=t;
}
}
}

for(i=0;i<10;i++)
printf("%d ",a[i]);
return 0;
}


...............