题解 | #统计成绩#

统计成绩

https://www.nowcoder.com/practice/cad8d946adf64ab3b17a555d68dc0bba

#include <stdio.h>

int main() {
    int major = 0;
    float grade[100] = {0};
    scanf("%d",&major);
    float max = 0;
    float min = 101;
    float sum = 0;
    for(int i = 0; i<major; i++)
    {
        scanf("%f",&grade[i]);
        max = (grade[i] > max? grade[i] : max);
        min = (grade[i] < min? grade[i] : min);
        sum += grade[i];
    }
    printf("%.2f %.2f %.2f",max,min,sum/major);

    return 0;
}

全部评论

相关推荐

安静的垂耳兔在泡澡:ks已经第八次投递了,它起码挂了还让你再投,不错了
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务