#include using namespace std; int main() { int i = 1, total1 = 0, total2 = 0; for (; i <= 100; i++) { if (i % 2 == 0) total1 += i; else total2 += i; } cout << "1~100的偶数和为: " << total1 << endl; cout << "1~100的奇数和为: " << total2 << endl; return 0; }