题解 | #统计成绩#

统计成绩

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

#include <stdio.h>
int main()
{
    int n = 0;
    float score = 0.0;
    float sum = 0.0;
    float Max = 0;
    float Min = 100;
    int count = 0;
    scanf("%d", &n);
    while(~scanf("%f ", &score))//多次输入and多组输入
    {
        count++;
        if(score > Max)
        {
            Max = score;
        }
        if(score < Min)
        {
            Min = score;
        }
        sum += score;
        if(count == n)
        {
            printf("%.2f %.2f %.2f", Max, Min, sum / n);
            sum = 0;
            Max = 0;
            count = 0;
            Min = 100;
        }

    }
    return 0;
}

全部评论

相关推荐

09-19 12:15
门头沟学院 Java
迷茫的大四🐶:这下是真的打牌了,我可以用感谢信和佬一起打牌吗
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务