望远
#include "stdio.h"
void main()
{
int arr1[10],arr2[10];
int num1=0,num2=0,sum1=0,sum2=0;
int i=0,j=0,n;
scanf("%d",&n);
while(n!=0)
{
if(n%2==0)
{
arr1[i++]=n;
num1++;
sum1+=n;
}
else
{
arr2[j++]=n;
num2++;
sum2+=n;
}
scanf("%d",&n);
}
printf("偶数有:");
for(i=0;i<num1;i++)
{
printf("%d ",arr1[i]);
}
printf("\n平均数为:%d\n",sum1/num1);
printf("奇数有:");
for(i=0;i<num2;i++)
{
printf("%d ",arr2[i]);
}
printf("\n平均数为:%.2f\n",(float)sum2/num2);
}