#include<stdio.h>//header file
#include<conio.h>//header file
void main() //starting of the main() function
{
int i,l,a[10],j,t; //declaration of the variables
clrscr();
printf("program that sorts a list of integers by using a selection sort technique");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the length of the list");//taking input from the user
scanf("%d",&l);
printf("\nenter the elements in the list");
for(i=0;i<l;i++)
scanf("%d",&a[i]);
for(i=0;i<l-1;i++)
{
for(j=i+1;j<l;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe elements after selection sorting is="); //printing output
for(i=0;i<l;i++)
printf("%d ",a[i]);
getch();
}