diff --git a/C/Selection_sort.c b/C/Selection_sort.c new file mode 100644 index 0000000..ead2366 --- /dev/null +++ b/C/Selection_sort.c @@ -0,0 +1,29 @@ +// C Program to arrange the array using selection sort + +#include +#include +int main() +{ + int n,i,j,min=0,temp=0; + printf("Enter the length of an array: "); + scanf("%d",&n); + int arr[n]; + printf("Enter the values: "); + for(i=0;iarr[j]) + min=j; + } + temp=arr[min]; + arr[min]=arr[i]; + arr[i]=temp; + } + printf("The arranged array is: "); + for(i=0;i