0

Write a program that allows the user to enter a series of positive integers one at a time and in increasing order (using -1 as a sentinel value), and then computes and displays the median value of the data entered, as well as the number of data values entered. You’ll find that to compute the median, you’ll need to store the input values in an array.

A sample run should look like:

Enter positive integers one at a time increasing order. Enter -1 to indicate when you are done.

Number? -2

Numbers must be positive. Redo that last one.

Number? 5

Number? 23

Number? 12

Numbers must increase. Redo that last one.

Number? 42

Number? 64

Number? -1

You entered 4 positive increasing values.

The median of those values is 32.5.