#include <stdio.h>
#include <ctype.h>
int main(void)
{
int c;
int n_ou=0, n_ji=0, n_oushu=0, n_jishu=0;
float n_oup=0, n_jip=0;
printf("请输入一些整数: ");
while((scanf("%d", &c)) == 1)
{
if(c == 0)
break;
switch(c % 2)
{
case 0:
n_ou++;
n_oushu += c;
n_oup = (n_oushu / n_ou);
break;
case 1:
n_ji++;
n_jishu += c;
n_jip = (n_jishu / n_ji);
break;
}
}
printf("有%d个偶数,偶数平均值为%.2f.\n", n_ou, n_oup);
printf("有%d个奇数,奇数平均值为%.2f.\n", n_ji, n_jip);
return 0;
}