数组例题
求输入数的平均数
#include<stdio.h>
int main()
{
int x;
double sum = 0;
int cnt = 0;
int number[100];
scanf("%d",&x);
for(cnt=1;x!=-1;cnt++)
{
number[cnt] = x;
sum+=x;
scanf("%d",&x);
}
if(cnt>0)
{
int i;
int average = sum/cnt;
printf("%d\n",average);
for(i=0;i<cnt;i++)
{
if(number[i]>average)
{
printf("%d ",number[i]);
}
}
}
}