hi.i m trying to this program for QuickSort but unable to detect what's wrong in it..probably the prblem is in Divison..

so here's the code:icon_eek::

```
# include <iostream>
using namespace std;
# define N 20
int Divide(int a[],int left,int right)
{
if (right < 1)
return 0;
int i=a[left], x;
int lower=left;
int upper=right;
while(true)
{
while(i > a[lower])
lower++;
while(i < a[upper])
upper--;
if(lower < upper)
{
x=a[lower];
a[lower]=a[upper];
a[upper]=x;
}
else
break;
}
a[left]=a[lower];
a[lower]=i;
return lower;
}
void QuickSort(int a[],int left,int right)
{
int pivot=Divide(a,left,right);
if(left < right)
{
QuickSort(a,left,pivot-1);
QuickSort(a,pivot+1,right);
}
}
void main ()
{
int a[N],n, i;
cout<<"\nInput The Number Of Elements You Want To Enter(For Ascending Order):";
cin >>n;
cout<<"\nInput The Elements:";
for (i=1;i<=n;i++)
{
cin>>a[i];
}
i=1;
QuickSort(a,i,n);
cout<<"\nThe Sorted Elements In Ascending Order According To QuickSort Are As Follows:";
for (i=1;i<=n;i++)
{
cout<<a[i]<<'\n';
}
}
```

Thanks in advance:icon_smile: