int k = 100, a[10000];
int i, over_ave = 0, s, n = 0, sum = 0;
float ave;
scanf("%d", &s);
while (s!=-1)
{
a[n] = s;
sum = sum + s;
n++;
scanf("%d", &s);
}
ave = sum / (float)n;
for (i = 0; i < n; i++)
{
if (a[i] > ave)
over_ave++;
}
printf("%.2f,%d\n", ave, over_ave);
return 0;
}
这里的ave=sum/(float)n 吧(float) 去掉为什么就错了 不明白