Ptogram 11-selection sort
#include <stdio.h>
#include <conio.h>
Void selectionSort(int arr[], int n)
For (int I = 0; I < n – 1; i++)
Int minIndex = I;
For (int j = I + 1; j < n; j++)
If (arr[j] < arr[minIndex])
minIndex = j;
// Swapping arr[i] and arr[minIndex]
Int temp = arr[i];
Arr[i] = arr[minIndex];
Arr[minIndex] = temp;
Void main()
{
Int size;
Printf(“Enter the size of array: “);
Scanf(“%d”, &size);
Int arr[size];
Printf(“Enter the elements of the array: “);
For (int I = 0; I < size; i++)
Scanf(“%d”, &arr[i]);
selectionSort(arr, size);
printf(“Array after Selection Sort:\n”);
for (int I = 0; I < size; i++)
Printf(“%d “, arr[i]);
Getch();