Sort Array Element


C Program to sort a list (array) of elements in descending order.


#include  <stdio.h>
#include  <conio.h>

void  sort(int  x[ ] , int  n);

void  main()
{
  int  i , n , x[50] ;

  clrscr() ;

  printf("Enter the number of elements: ") ;
  scanf("%d" , &n) ;
  printf("Enter the elements: \n") ;
  for(i=0 ; i x[j+1] */



Output :


Enter the number of elements: 5
Enter the elements: 
1 3 2 4 5
Elements of list in descending order is as shown: 
5 4 3 2 1