关于C语言的问题,求大神帮帮忙!!!
1个回答
展开全部
void Main()
{
int smaller = 0;
float avg = 0;
int n = 0;
int number[100];
int sum=0;
printf("输入数组的个数:");
scanf("%d",&n);
printf("输入数组:");
for (int i = 0; i < n; i++)
{
scanf("%d",&number[i]);
sum+=number[i];
}
avg=sum/n;
for (int i = 0; i < n; i++)
{
printf("数组为:");
printf("%d,",number[i]);
if (number<avg)
{
smaller++;
}
}
printf("\n");
printf("平均值为:\n",avg);
printf("小于平均值的个数为:",smaller);
}
{
int smaller = 0;
float avg = 0;
int n = 0;
int number[100];
int sum=0;
printf("输入数组的个数:");
scanf("%d",&n);
printf("输入数组:");
for (int i = 0; i < n; i++)
{
scanf("%d",&number[i]);
sum+=number[i];
}
avg=sum/n;
for (int i = 0; i < n; i++)
{
printf("数组为:");
printf("%d,",number[i]);
if (number<avg)
{
smaller++;
}
}
printf("\n");
printf("平均值为:\n",avg);
printf("小于平均值的个数为:",smaller);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询