In this problem, you are required to write a C program to search for maximal and minimal values in a series of floating-point data. Here you would like to input n values. You can update some variables as you read in new values. Finally, you will output the minimal and maximal values of all your inputs. The following is a demo process for the program if you can do it successfully: (red indicates input)

The first number is an integer n
, which represent show many floating point numbers the user wants
to input. The followingn
inputs aren floats with at most 1 decimal digit
, which are the n numbers
you want to calculate themin
andmax
.
Note that it is not certain how many inputs there are, so we recommend not using an array.
First, your program should output a prompt"Please type number of inputs: "
Then, after the user inputn
andn numbers
.
Your program should output two lines.
The first line is"Max value: "
and the maximum value of the inputs followed.
The second line is"Min value: "
, and the minimum value of the inputs followed.
* All of your outputs should be printed with “printf” to only 1 decimal point digit floating point number, even if a number is an integer.
* The value of inputs are restricted to be between -10000.0 and 10000.0.
* (The quotation marks are not to be printed.)
5
3.2
1.6
7.8
8.3
5.1
Please type number of inputs: Max value: 8.3
Min value: 1.6