To sort the given numbers using selection sort

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int i, j, k, left, n, a[10], t;
    clrscr();
    printf("Enter the limit : ");
    scanf("%d", &n);
    printf("\nEnter the elements :\n\n");
    for(i = 0; i < n; i++)
    scanf("%d", &a[i]);
    for(i = 0; i < n; i++)
    {
        left = a[i];
        k = i;
        for(j = i + 1; j < n; j++)
        if(left > a[j])
        {
            left = a[j];
            k = j;
        }
        a[k] = a[i];
        a[i] = left;
    }
    printf("\nThe sorted elements are :\n\n");
    for(i = 0; i < n; i++)
    printf("%d\t", a[i]);
    getch();
}

Output:

Enter the limit : 5
Enter the elements :
20 40 30 50 10
The sorted elements are :
10 20 30 40 50