#include <stdio.h>
int main()
{
int count=0,num=0;
double score,total=0;
printf("enter scores:");
scanf("%lf",&score);
while(score>=0){
total=total+score;
num++;
if(score<60){
count++;
}
scanf("%lf",&score);
}
if(num!=0){
printf("average is: %.2lf\n",total/num);
printf("number of failures is: %d\n",count);
}else{
printf("average is 0");
}
return 0;
}
计算平均成绩
最新推荐文章于 2024-10-04 05:48:57 发布