#include<stdio.h>
#include<math.h>
#include<string.h>
float MAX, MIN ;
int main() {
float ave(float arry[], int n);
float a[10];
printf("请输入十个同学的成绩:");//89 95 87.5 100 67.5 97 59 84 73 98
for (int i = 0; i < 10; i++) {
scanf_s("%f", &a[i]);
}
printf("MAX=%6.2f,MIN=%6.2f\n平均成绩为:%6.2f\n", MAX, MIN, ave(a,10));
}
float ave(float arry[ ],int n){
float sum=arry[0], average;
MAX = MIN =arry[0];
for (int i = 1; i < n; i++) {
sum = sum + arry[i];
if (MAX < arry[i])
MAX = arry[i];
else if (MIN > arry[i])
MIN = arry[i];
}
average = sum / n;
return average;
}