Question: Write a C program that first asks the following input from the user: integer array of 10 elements After storing the integer array of 10
Write a C program that first asks the following input from the user: integer array of 10 elements
After storing the integer array of 10 elements, the program gives two 2choices to the user to select: choice 1: Bubble sort choice 2: Exit
If the user gives input as 1, the program sorts the array using bubble sort. In the case of input as 2, Quicksort is used for sorting. After sorting is done, the program should print the sorted array to the console.
Note: 1. Write separate functions for bubble sort, quick sort, and printing the array. The method declaration is as follows: - void bubbleSort(int num[10], int n); // num[10] is the input array given by user // n is the size of the array
- void quickSort(int num[10], int first, int last); // num[10] is the input array given by user // first is the start indexof the array // last is the end index of the array
- void printArray (int num[], int size); // num[10] is the input array given by user // n is the size of the array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
