#include<stdio.h>
int main()
{
int a[100],i,j,n,temp;
printf(“How many no. you want to add in an array:”);
scanf(“%d”,&n);
printf(“Enter element of an array:\n”);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
}
printf(“Array before sorting is:\n”);
for(i=0;i<n;i++)
{
printf(“%d\n”,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(“Array after sorting is:\n”);
for(i=0;i<n;i++)
{
printf(“a[%d]=%d\n”,i,a[i]);
}
}