It will sort and print the array in the ascending order, by using the selection sort.
It will sort and print the array in the ascending order, by using the bubble sort.
It will sort and print the array in the ascending order, by using the quick sort.
Which of the given functions will be performed by the following program?
#include <stdio.h>
void main()
{
int arr1[15];
int a, b, number1, tmp_no;
printf("Enter any value between 2 and 15\n");
scanf("%d", &number1);
printf("Enter elements\n");
for (a = 0; a < number1; a++)
{
scanf("%d", &arr1[a]);
}
for (a = 0; a < number1; a++)
{
for (b = 0; b < (number1 – a – 1); b++)
{
if (arr1[b] > arr1[b + 1])
{
tmp_no = arr1[b];
arr1[b] = arr1[b + 1];
arr1[b + 1] = tmp_no;
}
}
}
for (a = 0; a < number1; a++)
{
printf("%d\n", arr1[a]);
}
}
Correct Answer:
It will sort and print the array in the ascending order, by using the bubble sort.
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Embedded C MCQ Questions