PROGRAMMING:Calculate the average
Now calculate the average value for several groups of integers.
It is known that the absolute values of these integers are less than 100, and the number of integers in each group is no less than 1 and no more than 20.
Input format: first enter K (no less than 2, no more than 20). Next, input a set of data (at least one set of data) for each row, and each group has at least one data. When there are multiple data, there are 1 to 3 spaces between the two data. Enter 100 in the last line to mark the end of the input.
Output format: for each group of data, output the mean value of the first k data. If the number of data in the group is less than k, output the mean value of all data in the group. The average value of output only outputs the integer part, and directly ignores the decimal part.
Sample input:
three
10 30 20 40
-10 17 10
10 9
one hundred
Sample output:
twenty
five
9
answer:If there is no answer, please comment
It is known that the absolute values of these integers are less than 100, and the number of integers in each group is no less than 1 and no more than 20.
Input format: first enter K (no less than 2, no more than 20). Next, input a set of data (at least one set of data) for each row, and each group has at least one data. When there are multiple data, there are 1 to 3 spaces between the two data. Enter 100 in the last line to mark the end of the input.
Output format: for each group of data, output the mean value of the first k data. If the number of data in the group is less than k, output the mean value of all data in the group. The average value of output only outputs the integer part, and directly ignores the decimal part.
Sample input:
three
10 30 20 40
-10 17 10
10 9
one hundred
Sample output:
twenty
five
9
answer:If there is no answer, please comment