C program to print the descending order using if-else

C program to print the descending order using if-elseĀ conditionĀ  for beginners to sort the program in descending order which means the bigger values are the first values in the output

#include<stdio.h>
void main()
{
int i,j,n,a[100],temp;
printf("Enter the elements\n");
scanf("%d",&n) ;
printf("Enter array elements\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]<a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("After descending order\n");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
}

Enter the elements

5

Enter array elements

34 65 1 78 65

After descending order

78 65 65 34 1