/* Note:Your choice is C IDE */
#include “stdio.h”
void main()
{
float amount=0,aver,total=0;
int i;
for(i=1;i<=1000;i++){
printf(“第%d个人捐钱为:”,i);
scanf("%f",&amount);
total=total+amount;
if(total>=20000) break;
}
aver=total/i; //平均值
printf(“捐款人数为:%d\n每人捐款平均值为:%10.2f\n共捐款金额%.2lf”,i,aver,total);
}
募集捐款p——122例5.4
最新推荐文章于 2024-03-16 08:37:29 发布