#include<iostream>
using namespace std;
void SS(int arr[], int n)
 {
  for (int i = 0; i < n - 1; i++) 
  {
    int min = i;
    for (int j = i + 1; j < n; j++) 
	{
      if (arr[j] < arr[min]) 
	  {
        min = j;
      }
    }
    int temp=arr[min];
    arr[min]=arr[i];
    arr[i]=temp;
  }
}
int main()
{
int arr[]={12,8,4,6,5,3};
int n= sizeof(arr)/sizeof(arr[0]);
SS(arr,n);
cout<<"sorted array is ";
for(int k=0;k<n;k++)
{
	cout<<arr[k]<<" ";
}
return 0;

}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: