输入一个正整数repeat (0<repeat<10),做repeat次下列运算: 读入一批正整数(以零或负数为结束标志),求其中的奇数和。
#include <stdio.h>int main( )
{
int ri, repeat;
int x, sum;
printf("Enter a repeat:");
scanf("%d", &repeat);
for(ri=1; ri<=repeat; ri++){
scanf("%d", &x);
sum=0;
while(x>0){
if(x%2!=0)
sum=sum+x;
scanf("%d",&x);
}
printf("%d\n", sum);
}
}