#include<stdio.h>
#include<conio.h>
void main()
{
int a[50];
int i,n,j,k,x,temp;
clrscr();
printf("Enter the number of elements you want to enter");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("a[%d] =",i);
scanf(" %d",&a[i]);
}
for(j=0;j<n-1;j++)
{
for(k=0;k<n-j-1;k++)
{
if(a[k]>a[k+1])
{
temp=a[k];
a[k]=a[k+1];
a[k+1]=temp;
}
}
}
printf("\n\nSORTED ARRAY IS:\n\n");
for(x=0;x<n;x++)
{
printf("\na[%d] = %d",x,a[x]);
}
getch();
}