Bubble Sort

#include<iostream.h>
#include<conio.h>


void BubbleSort(int a[],int n)
{
    int i,j,temp;
    for(i=0;i<=n;i++)
        {
            for(j=0;j<(n-1)-i;j++)
                {
                if(a[j]>a[j+1])
                {
                    temp=a[j];
                    a[j]=a[j+1];
                    a[j+1]=temp;
                }
                }
        }
}
void main()
{
clrscr();
int a[50],i,n,d,pos;
cout<<"Enter the number of elements ";
cin>>n;
cout<<"Enter the elements";
for(i=0;i<n;i++)
    {
    cin>>a[i];
    }
BubbleSort(a,n);
cout<<"Ascending Order";
for(i=0;i<n;i++)
    {
    cout<<a[i]<<",";
    }
getch();
}