统计捐款人数及捐款.c 322 B

123456789101112131415161718
  1. #include <stdio.h>
  2. int main() {
  3. int count = 0;
  4. float sum = 0.0;
  5. while(sum<100000.0) {
  6. float money;
  7. printf("请依次输入捐款钱数:");
  8. scanf("%f",&money);
  9. sum += money;
  10. count++;
  11. }
  12. printf("第%d个人捐款之后达到10万+\n",count);
  13. printf("平均每人捐款:%.2f",sum / count);
  14. return 0;
  15. }