/* Insertion sorting is a sorting technique in which every element will be placed at their position in such a way that they will be sorted*/
#include
int main ()
{
int n,i,j,k,c;
int a[30];
printf(“Enter size of array: \n”);
scanf(“%d”,&n);
printf(“Enter %d elements of array: \n”,n);
for (i=0; i<n; i++)
scanf("%d",&a[i]);
printf("Unsorted Array is: \n");
for (i=0; i<n; i++)
printf("%d ",a[i]);
//sorting begins
for (i=1; i<n; i++)
{
for (j=0; j<i; j++)
{
if (a[i]=j; c–)
a[c+1] = a[c];
a[c+1] = k;
}
}
}
printf(“\nSorted array is\n”);
for (i=0; i<n; i++)
printf("%d ",a[i]);
return 0;
}
– INSERT —