// write a c program to implement selection sort
#include <stdio.h>
int main() {
int n = 5;
int i,j,a[n],temp,min = 0 ;
printf("Enter the array elements:");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i = 0;i<n;i++){
min = i;
for(j = i+1;j<n;j++){
if(a[min] > a[j]){
min = j;
}
}
printf("i = %d \t min = %d\n",i,a[min]);
temp = a[i];
a[i] = a[min];
a[min] = temp;
}
for(i=0;i<n;i++){
printf("%d\t",a[i]);
}
return 0;
}