#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i,num,sum,count,c90,c89,c78,c67,c60;
double average;
average=sum=count=c90=c89=c78=c67=c60=0;
printf("请输入一个数学成绩\n");
scanf("%d",&num);
while(i=0,i<8,i++)
{
count=count+1;
sum=sum+num;
if(num>=90)
{
c90=c90+1;
}
else if(num>=80)
{
c89=c89+1;
}
else if(num>=70)
{
c78=c78+1;
}
else if(num>=60)
{
c67=c67+1;
}
else if(num>=0 && num<60)
{
c60=c60+1;
}
average=sum/count;
printf("输入一个成绩%d\n");
scanf("%d",&num);
}
printf("sum=%d\n",sum);
printf("count=%d\n",count);
printf("c90=%d\n",c90);
printf("c89=%d\n",c89);
printf("c78=%d\n",c78);
printf("c67=%d\n",c67);
printf("c60=%d\n",c60);
printf("average=%0.2f\n",average);
}
#include <stdlib.h>
int main(void)
{
int i,num,sum,count,c90,c89,c78,c67,c60;
double average;
average=sum=count=c90=c89=c78=c67=c60=0;
printf("请输入一个数学成绩\n");
scanf("%d",&num);
while(i=0,i<8,i++)
{
count=count+1;
sum=sum+num;
if(num>=90)
{
c90=c90+1;
}
else if(num>=80)
{
c89=c89+1;
}
else if(num>=70)
{
c78=c78+1;
}
else if(num>=60)
{
c67=c67+1;
}
else if(num>=0 && num<60)
{
c60=c60+1;
}
average=sum/count;
printf("输入一个成绩%d\n");
scanf("%d",&num);
}
printf("sum=%d\n",sum);
printf("count=%d\n",count);
printf("c90=%d\n",c90);
printf("c89=%d\n",c89);
printf("c78=%d\n",c78);
printf("c67=%d\n",c67);
printf("c60=%d\n",c60);
printf("average=%0.2f\n",average);
}