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