```
#include<stdio.h>
#include<stdlib.h>
#define SIZE 15
double Average(int a[],int n);
int Array(int a[],int n);
int Input(int a[],int n) ;
int main()
{
double Average(int a[],int n);
int Array(int a[],int n);
int Input(int a[],int n);
int a[SIZE];
printf("请输入15名男生的年龄:\n");
Input(a,SIZE);
printf("输入正确的分别是%d\n",Array(a,SIZE));
Array(a,SIZE);
printf("这几名男生的平均年龄是:%f\n",Average(a,SIZE));
return 0;
}
int Input(int a[],int n)
{
int i;
for (i = 0;i < 15 ;i++)
{
scanf("%d",&a[i]);
}
}
double Average(int a[],int n)
{
int i;
int sum = 0;
int count = 0;
double average;
for(i = 0;i < 15;i++)
{
if(a[i]==0)
{
continue;
}
else
{
sum+=a[i];
count++;
}
}
average = (double)sum/count;
return average;
}
int Array(int a[],int n)
{
int i;
int count = 0;
for(i = 0;i < 15;i++)
{
if(a[i]==0)
{
continue;
}
else
{
printf("%-4d",a[i]);
count++;
}
}
return count;
}```