c语言编程练习题:7-121 作品评分
作者:yunjinqi   类别:    日期:2023-05-31 16:33:00    阅读:457 次   消耗积分:0 分    

image.png

#include <stdio.h>
int main(){
    double sum=0.0,avg=0.0;
    double score;
    double min_score=0.0,max_score=0.0;
    int n;
    if (scanf("%d",&n)!=EOF && n>2){
        for (int i=0;i<n;i++){
            if (scanf("%lf",&score)!=EOF){
                sum+=score;
                if (i==0){max_score=score;min_score=score;}
                if (i>0){
                    if (score>max_score){max_score=score;}
                    if (score<min_score){min_score=score;}
                }

            }
        }
        avg = (sum-max_score-min_score)/(n-2);
        printf("%.2f",avg);
    }
    else{
        printf("input wrong");
    }
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/246
上一篇:c语言编程练习题:7-120 兔子繁殖问题
下一篇:c语言编程练习题:7-122 3n 1