You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <stdio.h>
|
|
int main(void)
|
|
{
|
|
int a[1001];
|
|
int i,j,t,n;
|
|
scanf("%d",&n);
|
|
for(i=0;i<n;++i)
|
|
scanf("%d",a+i);
|
|
|
|
for(i=1;i<n;++i)
|
|
{
|
|
t=a[i];
|
|
for(j=i-1;j>-1 && a[j]>t;j--)
|
|
{
|
|
a[j+1]=a[j];
|
|
a[j+1]=t;
|
|
|
|
for(j=0;j<n;++j)
|
|
printf("%-5d",a[j]);
|
|
printf("\n\n");
|
|
}
|
|
return 0;
|
|
}
|