zoukankan      html  css  js  c++  java
  • 在全系1000学生中,征集慈善募捐,当总数达到10万元时就结束,统计此时捐款人数,以及平均每人捐款的数目

    #include <stdio.h>
    #define SUM 100000
    int main()
    {
        float amount,aver,total;
        int i;
        for(i=1,total=0;i<=1000;i++)
        {
            printf("please enter amount:");
            scanf("%f",&amount);
            total=total+amount;
            if(total>=SUM)break;
        }
        aver=total/i;
        printf("num=%d aver=%10.2f ",i,aver);
        return 0;
    }

  • 相关阅读:
    淘宝网六个质量属性场景
    架构漫谈阅读笔记2
    poj 3304
    poj 2318
    bzoj 4008
    任意模数NTT
    CF623E
    CF712E
    bzoj 1925
    bzoj 4710
  • 原文地址:https://www.cnblogs.com/LiQingXin/p/12796522.html
Copyright © 2011-2022 走看看