#include<stdio.h>
#define size 6
void swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}
int main()
{
int arr[size],i,j,k,key,temp;
printf("Please enter 6 elements: \n ");
for(i=0;i<=size-1;i++)
{
scanf("%d",&arr[i]);
}
for(i=1;i < size;i++)
{
int k = i-1;
temp = arr[i];
while(k>=0 && arr[k]>temp){
printf(" x = %d, y = %d\n", arr[k],temp);
swap(&arr[k],&arr[k+1]);
k--;
}
}
for(i=0;i<size ;i++)
{
printf("%d ",arr[i]);
}
return 0;
}