求助:关于FOR循环
代码如下,当输入a=9999时,退出循环,为什么结果sum都加了 a=9999 这个值呢?#include <stdio.h>
void main ()
{
int a, counter, sum=0;
float p=0;
for (counter=1; a!=9999; counter++)
{
printf ("Enter the integers ");
scanf ("%d", &a);
sum+=a;
}
p=(float)sum/(counter-1);
printf ("The privade of the integers is: %f\n", p);
return ;
}