第22261题 单选题
求正整数所有因数的C++代码,for循环处应填入的代码是

下面C++代码用于求正整数的所有因数,即输出所有能整除一个正整数的数。如,输入10,则输出为1、2、5、10;输入12,则输出为1、2、3、4、6、12;输入17,则输出为1、17。在横线处应填入代码是( )。

int n = 0;
cout << "请输入一个正整数: ";
cin >> n;
for (_________________________) // 此处填写代码
  if (n % i == 0)
    cout << i << endl;
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析