#include
int main()
{
int a[100],i,j,small,n,k;
printf(“Enter size of array:”);
scanf(“%d”,&n);
printf(“Enter element:\n”);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("Element and their position are:\n");
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
}
for(i=0;i<n;i++)
{
small=i;
for(j=i;j<n;j++)
{
if(a[j]<a[small])
small=j;
}
k=a[small];
a[small]=a[i];
a[i]=k;
}
printf("Arrar after selection sort:\n");
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
}
}