#include <stdio.h>
#define LEN 5
int a[LEN]={10,5,2,4,7};
void selection_sort(void)
{
int i,j,key;
for(i=0;i<LEN-1;i++) {
printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
key=a[i];
j=i+1;
while(j<LEN && a[j]<key) {
key=a[j];
a[j]=a[i];
a[i]=key;
j++;
}
}
printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
}
int main(void)
{
selection_sort();
return 0;
}