Problem-
To sort array in such a way that number greater than first element is on right side and less than first element is on left side
Sample input-
5
4 5 3 7 2 (Taking 4 as reference)
Sample output
3 2 4 5 7
My code is sorting in this way
Input
5
12
16
2
3
56
output
2
3
2
3
56
int main()
{
int i,j,n,temp;
printf("enter no of elements of array");
scanf("%d",&n);
int a[n];
printf("enter array\n");
for(i=0;i<=n-1;i++)
{
scanf("%d",&a[i]);
}
j=0;
for(i=1;i<=n-1;i++)
{
if(a[i]<a[j])
{
temp=a[j];
a[j]=a[i];
a[i]=a[j];
j++;
}
}
for(i=0;i<n;i++)
{
printf("Array is%d\n",a[i]);
}
}