Sunday, 27 November 2011

C Program For Selection Sorting


#include<stdio.h>
#include<conio.h>
void main()
{
    int a[10],i,j,temp;
clrscr();
for(i=1;i<10;i++)
{
  printf("Enter number");
  scanf("%d", & a[i])'
}
for(i=0;i<10;i++)
{
  for(j=0;j<10;j++)
   {
 if(a[j]>a[j+1])
  {
    temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
  }
}
 }

 for(i=0;i<10;i++)
  printf("%d",a[i]);
 
 
  getch();
 
 }  


No comments:

Post a Comment