c语言编程练习题:7-137 Average
作者:yunjinqi   类别:    日期:2023-05-31 17:13:38    阅读:120 次   消耗积分:0 分    

image.png

#include <stdio.h>

int main(){
    int n;
    int count=0;
    int sum=0;
    while (scanf("%d",&n)!=EOF && n>=0){
        count++;
        sum+=n;
        
        
    }
    if (count>0){printf("%.2f\n", (double)sum/count);}
    if (count==0){printf("None");}
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/262
上一篇:c语言编程练习题:7-136 穷举问题-搬砖
下一篇:c语言编程练习题:7-138 质因子分解