Question: programming C The idea here is a program that uses a sentinel loop and some comparison inside the loop for some simple number processing. The
programming C
The idea here is a program that uses a sentinel loop and some comparison inside the loop for some simple number processing. The numbers are entered in pairs, but they are echoed back to the user with the smaller number on the left and the larger on the right. You will need to keep track of the largest and smallest number entered in order to find the overall range (i.e. the difference between smallest and largest). You are to create a program that uses all integer values and has this interaction: Enter your two numbers or 0 0 to quit:18 5 Ordered these numbers are 5 18 The median is 12. Enter your two numbers or 0 0 to quit:26 29 Ordered these numbers are 26 29 The median is 28. Enter your two numbers or 0 0 to quit: 0 489 Ordered these numbers are 0 489 The median is 245. Enter your two numbers or 0 0 to quit:65 0 Ordered these numbers are 0 65 The median is 33. Enter your two numbers or 0 0 to quit:0 -47 Ordered these numbers are -47 0 The median is -22. Enter your two numbers or 0 0 to quit:0 0 You had 5 pairs of numbers. The overall range of your numbers was 536. Notes . That if the numbers are entered with the larger number first they are "ordered by being displayed in the reverse order. . That the sentinel value is 0 O, not just one zero. That a sentinel loop works by using a priming read and a read at the bottom. You will use a while loop that only runs until the "sentinel" or stopping values are entered for the data values. That when the median value would be normally something like 2.5, it is rounded up rather than down. (Which is what integer division naturally does.) This one is a bit tricky to figure out, and it involves something we know about %2 ... that the overall range is calculated as the difference between the largest number entered the smallest number entered throughout the run of the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
