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