Question: 1. Write a program in C to sort element of an array in ascending AND descending order. Keep original array unchaged, create two new arrays.

1. Write a program in C to sort element of an array in ascending AND descending order. Keep original array unchaged, create two new arrays.

1. one array for descending order

. 2. one array for ascending order.

CODE SKELETON

#define _CRT_SECURE_NO_WARNINGS #include int main(void) { // Initializing array int lengths[100]; // Declare loop variables, array counters etc. // Ask user for size of the array. // printf/scanf // Using a loop, input values for each element. // Loop through array, scanning in values. // Utilizing loops, sort the array in descending order. // Can use two nested loops, to test values of the array. // You will utilize a conditional statement (if) to correctly sort. // Using a loop, print all of the array values to the screen. //printf return(0); }

Your program should accomplish the following: a. Ask user for the size of the array and use a loop to fill the array with values. b. Using loops, sort the values of the array in descending and ascending order which will be saved into your two separate arrays.

(You can utilized 2 nested loops to perform the sorting) You will also utilize a conditional statement to perform the sorting correctly. c. Print the both arrays to the screen (using loops). Showing both ascending and descending orders. d. Code should be uploaded as a .txt file and a screenshot of the screen displaying your array is required. e. Provide comments that explain the basic logic of your loop structure and how it performs sorting or points will be taken off.

In mathematics, the factorial of a non-negative integer n, denoted by n!. n!, is the product of all positive integers less than or equal to n.

note: (0! = 1)

Ex.

4! = 4*3*2*1 = 24

5! = 5*4*3*2*1 = 120

n! = n*(n-1)*(n-2)*. . .*3*2*1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!