题解 | #统计成绩#
统计成绩
https://www.nowcoder.com/practice/cad8d946adf64ab3b17a555d68dc0bba
#include <stdio.h> int main() { int n; double A[100]; double sum = 0; double p; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf", &A[i]); sum = sum + A[i]; } p = sum / n; double min, max; min = max = A[0]; for (int i = 0; i < n; i++) { if (max < A[i]) max = A[i]; if (min > A[i]) min = A[i]; } printf("%.2lf %.2lf %.2lf", max, min, p); return 0; }