题解 | #公务员面试#
公务员面试
https://www.nowcoder.com/practice/f3a134908d5b41869f14f58307008a97
#include <stdio.h> int main() { int arr[7] = { 0 }; int max, min, sum; while (scanf("%d %d %d %d %d %d %d",&arr[0],&arr[1],&arr[2],&arr[3],&arr[4],&arr[5],&arr[6])!=EOF) { max = 0, min = 100,sum = 0; for (int i = 0; i < 7; i++) { if (arr[i] > max) max = arr[i]; if (arr[i] < min) min = arr[i]; sum += arr[i]; } sum = sum - max - min; printf("%.2f\n", sum / 5.0); } return 0; }