第22676题 单选题
以下求1~N奇数之和的C++代码描述错误的是
int N;
cout << "请输入正整数:";
cin >> N;
int i = 1, Sum = 0;
while (i <= N){
if (i % 2 == 1)
Sum += i;
i += 1;
}
cout << i << " " << Sum;
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析