代码语言:javascript复制
#include <stdio.h>
#include <math.h>//fabs
#include <stdlib.h>//abs
int main() {
int i = 1, sum_odd = 0, sum_even = 0;
while (i <= 20) {
if (i % 2 == 0)
sum_even = sum_even i;
else
sum_odd = sum_odd i;
i ;
}
printf("偶数和%d,奇数和%d", sum_even, sum_odd);
return 0;
}