write a program in c to implement sorting print the output in ascending order

Write a program in c to implement sorting print the output in ascending order. This program will sort the array elements in the ascending order in output. Putting numbers in ascending order means starting with the smallest and working your way up to the highest

#include<stdio.h>
void main()
{
int i,j,n,a[100],temp;
printf("Enter the number of elements\n") ;
scanf("%d",&n) ;
printf("Enter the 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 Ascending order\n");
for(i=0;i<n;i++)
{
printf("%d ",a[i]) ;
}
}

 

Output:

Enter the number of elements

5

Enter the elements

54 1 67 89 54 After Ascending order 1 54 54 67 89