第35063题 判断题
下面的 C++ 代码段可以正确判断输入的正整数是否为对称数(回文数,即从左到右和从右到左读数值相同,例如 121、4114 都是对称数)。
int n, old_num, new_num = 0;
cin >> n;
old_num = n;
while (n != 0) {
    new_num = new_num * 10 + n % 10;
    n /= 10;
}
if (old_num == new_num)
    cout << "对称数";
else
    cout << "非对称数";
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析