Write a C program that will sort numbers in any sequence depending upon user's requirements. Test your code for each case and display the results at the end of program execution.

Your C code should implement the following sub tasks:

  • The program should prompt for the total number which are required to sort (minimum 10). This will be dynamic array whose elements are decided on run time by the user.
  • If the user enters less than 10 than the program should prompt with an error message saying, "Minimum 10 numbers are required for sorting". After displaying the error message, the program should prompt again until the requirement is satisfied.
  • The program should not prompt the user to enter the numbers as specified.
  • The program should prompt the user for sorting method:
    • Ascending.
    • Descending.
  • After sorting, the program should display the unsorted and sorted sequence, for verification.
  • The ascending, descending and swap codes should be implemented as three independent functions.
  • Write comments on each code line explaining the purpose of the code.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.