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