main写错了,写成mian了改过来啊
#include"stdio.h"
int main()//main写错了,现在可以正常运行了
{
float average;
int score[10]={99,78,66,89,97,68,77,87,60,100},i,sum=0;
for(i=0;i<10;i++)
sum+=score[i];
average=(float)sum/10;
printf("the average score is %2f\n",average);
}
/*
运行结果:
the average score is 82.099998
*/
#include"stdio.h"
void mian()
{
float average;
int score[10]={99,78,66,89,97,68,77,87,60,100},i,sum=0;
for(i=0;i<10;i++)
sum+=score[i];
average=(float)sum/10;
printf("the average score is %2f\n",average);
}
%2f改成 0.2f 就可以了