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