Final answer:
The C program should calculate the max and average of an undetermined number of non-negative integers, ending input with any negative integer, and then output these values.
Step-by-step explanation:
The task is to write a C program that calculates statistical data such as maximum value (max) and average from a series of non-negative integers and outputs these figures, terminating the input when a negative integer is encountered. The program must ignore the negative integer and must provide the average to two decimal places using the specified printf format.
Example Program Flow:
- Initialize variables to store sum, count, max, and a temporary input.
- Use a loop to read numbers until a negative integer is inputted.
- Update sum, count, and max with each inputted non-negative integer.
- Calculate the average by dividing the sum by the count.
- Output the max and average as specified.