代码能否实现功能?统计正分数人数 总分,及平均分
#include<stdio.h>
void main()
{
int score,sum=0,j,k;
float avg,n=0;
{
scanf("%d",&score);
for(j=1;j<=10;j++);
if(score>0)
{
n++;
sum=sum+score;
}
avg = sum/n;
printf("平均分=%f 总分=%d n=%f",avg,sum,n);
}
#include<stdio.h>
void main()
{
int score,sum=0,j,k;
float avg,n=0;
{
scanf("%d",&score);
for(j=1;j<=10;j++);
if(score>0)
{
n++;
sum=sum+score;
}
avg = sum/n;
printf("平均分=%f 总分=%d n=%f",avg,sum,n);
}
2017-05-07
举报