#include <stdio.h>
void main()
{
float score[10], sumScore, minScore, maxScore;
int i, j;
for (i = 0; i < 9; i ++)
{
printf("please input %d score\n", i + 1);
scanf("%f", &score[i]);
}
sumScore = minScore = maxScore = score[0];
for (j = 1; j < 9; j ++)
{
if (score[j] > maxScore)
{
maxScore = score[j];
}
else if (score[j] < minScore)
{
minScore = score[j];
}
sumScore += score[j];
}
sumScore -= maxScore;
sumScore -= minScore;
printf("the average is %f\n", sumScore/7);
}
4. 编写一个程序,读入9个裁判所打的分数,去掉一个最高分,去掉一个最低分,求剩余7个分数的平均值(要求用数组实现)。
最新推荐文章于 2023-08-16 14:52:54 发布