做了个统计多名学生成绩的程序,但无法运行,求大神指点
#include<stdio.h>int main()
{
int i=1;
float score,max,min,sum,ave;
printf("Please input a grade!\n");
scanf("%f",score);
max=min=sum=score;
while(score!=-1)
{
printf("Please input another grade!\n");
scanf("%f",score);
if(score>max)
max=score;
if(score<min&&score!=-1)
min=score;
sum+=score;
i++;
}
sum=sum+1;
ave=sum/(i-1);
printf("max=%6.2f,min=%6.2f,aver=%6.2f\n",max,min,ave);
return 0;
}
一旦运行,就显示"应用程序错误,内存不能为written"