Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Selection Sort(arrays) in C

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int arr[10],i,j,t;
    clrscr();
    printf("Enter 10 elements");
    for(i=0;i<10;i++)
     scanf("%d",&arr[i]);
    //Sort array
    for(i=0;i<10;i++)
    {
      for(j=i+1;j<10;j++)
     {
      if(arr[i]>arr[j])
     {
     t=arr[i];
    arr[i]=arr[j];
    arr[j]=t;
     }
     }
    }
    printf("The sorted list is:");
    for(i=0;i<10;i++)
    {
    printf("%d ",arr[i]);
    }
    getch();
    }