#include<stdio.h>
int main() {
int num1, num2;
int o = 0;
int p = 0;
int arg[10] = {};
int arg1[10] = {};
int arg2[10] = {};
scanf("%d %d %d %d %d %d %d %d %d %d", &arg[0], &arg[1], &arg[2], &arg[3], &arg[4], &arg[5], &arg[6], &arg[7], &arg[8], &arg[9]);
while ((o < 10)&&(arg[o] % 2 == 1)) {
arg1[o] = arg[o];//将arg中的奇数赋给arg1
o++;
}
while ((p < 10 )&& (arg[p] % 2 != 1)) {
arg2[p] = arg[p];//将arg中的偶数赋给arg2
p++;
}
num1 = arg1[0]+ arg1[1] + arg1[2] + arg1[3] + arg1[4] + arg1[5] + arg1[6] + arg1[7] + arg1[8] + arg1[9] ;
num2 = arg2[0] + arg2[1] + arg2[2] + arg2[3] + arg2[4] + arg2[5] + arg2[6] + arg2[7] + arg2[8] + arg2[9];
printf("奇数为%d\n", num1);
printf("偶数为%d", num2);
}
为啥不行啊