int main()
{
int even_sum=0,even_n=0,odd_sum=0,odd_n=0;
int a,sign;
printf("Please enter the numbers end by 0:");
while(1)
{
scanf("%d",&a);
if(a==0) break;
sign=a%2;
switch(sign)
{
case 0:even_n++;even_sum+=a;break;
case 1:odd_n++;odd_sum+=a;break;
default: break;
}
}
printf("\n");
printf("The number of even is %d,and the average is %d.\n",even_n,even_sum/even_n);
printf("The number of odd is %d,and the average is %d.\n",odd_n,odd_sum/odd_n);
printf("\n");
return 0;
}