7-25 求奇数和
1 #include <stdio.h> 2 3 int main(void) 4 { 5 int num; 6 int sum = 0; 7 while (1) 8 { 9 scanf("%d", &num); 10 if (num <= 0) 11 { 12 break; 13 } 14 else if (num % 2 == 1) 15 { 16 sum = sum + num; 17 } 18 } 19 20 printf("%d", sum); 21 22 return 0; 23 }