//看题解基本不是用数组写的,用数组写的话不能多组输入,突然想到这样写就成了 #include<stdio.h> int main() { int arr[7] = {0}; int i = 0, max = 0, min = 100, sum = 0; while (scanf("%d", &arr[i]) != EOF) { if (arr[i] > max) max = arr[i]; if (arr[i] < min) min = arr[i]; sum += arr[i]; i++; if (i == 7) { printf("%.2f\n", (sum - max - min) / 5.0); i = 0, max = 0, min = 100, sum = 0; } } return 0; }