Program in C to arrange the elements in array in descending order

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

void main()
{
            int a[100],i,n,j,search,temp;
            printf("\n how many no's in array");
            scanf("%d",&n);
            printf("\n enter %d elements in array",n);
            for(i=0;i
                        scanf("%d",&a[i]);
            for(i=0;i
            {
                        for(j=i+1;j
                        {
                                    if(a[i]
                                    {
                                                temp=a[i];
                                                a[i]=a[j];
                                                a[j]=temp;
                                    }
                        }
                        printf("%4d",a[i]);
            }
            getch();
}


Post a Comment