题解 | #公务员面试#
公务员面试
http://www.nowcoder.com/practice/f3a134908d5b41869f14f58307008a97
int main() { int arr[7] = { 0 }; int sz = sizeof(arr) / sizeof(arr[0]); int i = 0; int sum = 0; for (i = 0; i < sz; i++) { scanf("%d", &arr[i]); sum += arr[i]; } int max = arr[0]; for (i = 1; i < sz; i++) { if (arr[i] > max) { max = arr[i]; } } int min = arr[0]; for (i = 1; i < sz; i++) { if (arr[i] < min) { min = arr[i]; } } float ret = (sum - max - min) / 5.0; printf("%.2f", ret); return 0; }