Question: Problem 5 (10 points) Write a C program, called sort3.c, that performs the following task. The program first prompts the user to enter three integers

 Problem 5 (10 points) Write a C program, called sort3.c, that

performs the following task. The program first prompts the user to enter

three integers a, b, and c. It then sorts these integers in

Problem 5 (10 points) Write a C program, called sort3.c, that performs the following task. The program first prompts the user to enter three integers a, b, and c. It then sorts these integers in ascending order, so that swapping their values if necessary. Finally, the program prints the three integers entered by the user in ascending order. Here are a few sample runs of the program /home/userXYZ/ECE15/Final> sort3 Please enter three integers: 3 2 1 Here are the integers in ascending order: 1 2 3 /home/userXYZ/ECE15/Final> sort3 Please enter three integers: 42 -18 0 Here are the integers in ascending order: -18 0 42 /home/userXYZ/ECE15/Final> sort3 Please enter three integers: 1 2 3 Here are the integers in ascending order: 1 2 3 /home/userXYZ/ECE15/Final> sort3 Please enter three integers: 2 1 2 Here are the integers in ascending order: 1 2 2 In this problem, you do not need to verify the validity of the user input. You should assume that the user indeed enters three integers when prompted to do so There are many different ways to sort three integers a, b, c so that a b c. Here is one simple way that works. Perform the following sequence of three conditional swaps, in the specified order if a >b, swap a and b; if b >c, swap b and c if a > b, swap a and b; You can use the above method or any other method of your choice, but you are required to call the function sort-three () in order to sort a, b, and c. Moreover, the sorting has to be accomplished in place. In particular, you are not allowed to declare and use any variables inside the sort three( function. This function, however, can call other functions (such as the swap () function) that you will need to implement separately. Note that you are not allowed to use any functions from the C standard library, except for those declared in

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!