#include <stdio.h> int main() { int s1 = 0, s2 = 0, k = 1; while(k<=100){ if (k % 2 != 0) s1 = s1 + k; else s2 = s2 + k; k++; } printf("100以内,所有奇数的和为%d,偶数的和为%d", s1,s2); return 0; }