作业五:统计全班某门功课期末考试的平均分和最高分
#include <stdio.h>
int main() {
int score;
int i;
int maxScore = 0;
float avgScore = 0;
for (i = 0; i < 10; i++) {
printf("请输入第%d位同学的成绩:", i+1);
scanf_s("%d", &score);
avgScore += score;
if (score > maxScore) {
maxScore = score;
}
}
avgScore /= 10;
printf("平均分是: %f\n", avgScore);
printf("最高分是: %d\n", maxScore);
return 0;
}