在VC++6.0下运行的C语言程序,当输入负数结束,整数继续(这里没做0-100的限定,可以自己简单加上就行)
#include
void main()
{
float sum=0;
float average=0;
int i=0;
int score=0;
while(score>-1)
{
scanf("%d",&score);
//printf("%d\n",score);
sum=sum+score;
i=i+1;
}
average=sum/i;
printf("average=%.1f\n",average);
}
路过!!!!!!!