#include<stdio.h>
int main(void)
{
int workers=0;
double scores=0,total_score=0,max_scores=0,avg_score=0;
while (scanf("%lf",&scores) && scores >= 0)
{
if (scores > 100)
continue;
workers++;
total_score += scores;
if (max_scores < scores)
max_scores = scores;
}
avg_score = total_score / workers;
printf("total inpue %d workers\n",workers);
printf("average score is %5.2f \n",avg_score);
printf("max score is %5.2f \n",max_scores);
return 0;
}
试试这个是不是合你的要求
[此贴子已经被作者于2019-1-5 14:49编辑过]