Question: Exercise 2 Write a program that asks the user to enter an array of random numbers different from zero, then sort the numbers in a

 Exercise 2 Write a program that asks the user to enter

Exercise 2 Write a program that asks the user to enter an array of random numbers different from zero, then sort the numbers in a descending order, after that reverse it (the first element will be the last...). If the user enters 0 as a value of a number in the array, this value should be ignored and the program should ask him to enter again a value (check the example of execution for the case of A[1]). Also, the size of the array given by the user should be checked. Below an example of execution (user's input is in red): ************* Welcome to the sorting program ************* Please enter the size of the array A you want to sort in descending order: -2 Please enter the size of the array A you want to sort in descending order: 5 Please enter A[0]: 2 Please enter A[1]: 0 Please enter A[1]: 8 Please enter A[2]: 5 Please enter A[3]: 9 Please enter A[4]: 1 The array A you gave and want to sort is: 2 8 5 9 1 The array A sorted in a descending order: 9 8 5 2 1 Reversed sorted array A: 1 25 8 9 Note: Your codes should be well commented

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!