C Programs

Write a C program to sort the array of numbers?


/*  C Program sorts the numbers */
#include <stdio.h>
#include<conio.h>

int main()
{
  int number[] = {23,45,36,44,90}; /* give input array here*/
  int length=5;
  int i,j,temp;
  clrscr();
  for (i =0; i<length ; ++i){
      for (j = i + 1; j < length; ++j){
   if (number[i] > number[j]){
       temp =  number[i];
       number[i] = number[j];
       number[j] = temp;
   }
      }
  }
  printf("Sorted Array : ");
  for(i=0; i<length; i++){
  printf("%d ",number[i]);
  }
  printf("\n");
  getch();
  return 0;
}
www.000webhost.com