Write a program to enter 10 random numbers from the keyboard and sort them using Quick Sort Technique

/*
PROGRAM 18:
———–
Write a program to enter 10 random numbers from the keyboard and
sort them using Quick Sort Technique.
*/
#include<stdio.h>
#include<conio.h>

void main()
{
int a[10],lb=0,ub=9,i;
void quick(int[],int,int);
clrscr();

for(i=0;i<10;i++)
{
printf(“Enter number-%d: “,i+1);
scanf(“%d”,&a[i]);
}
quick(a,lb,ub);
printf(“\nSorted Array:\n”);
for(i=0;i<10;i++)
{
printf(“%d,”,a[i]);
}
getch();
}
void quick(int a[],int lb,int ub)
{
int i,j,key;
int temp,flag=1;
if(lb<ub)
{
i=lb;
j=ub;
key=a[lb];
while(flag==1)
{
i++;
while(key>a[i])
{
i++;
}
while(key<a[j])
{
j–;
}
if(i<j)
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
else
flag=0;
}
temp=a[lb];
a[lb]=a[j];
a[j]=temp;
quick(a,lb,j-1);
quick(a,j+1,ub);
}
}
/*
OUTPUT:
——-
Enter number-1: 9
Enter number-2: 8
Enter number-3: 4
Enter number-4: 6
Enter number-5: 2
Enter number-6: 45
Enter number-7: 32
Enter number-8: 21
Enter number-9: 20
Enter number-10: 10

Sorted Array:
2,4,6,8,9,10,20,21,32,45,
*/