第37609题 单选题
在下面的C++代码中,N必须是小于10大于1的整数,M为正整数(大于0)。如果M被N整除则M为幸运 数,如果M中含有N且能被N整除,则为超级幸运数,否则不是幸运数。程序用于判断M是否为幸运数或超级幸运数 或非幸运数。阅读下面代码,有关说法正确的是( )。
int N, M;
cout << "请输入幸运数字:";
cin >> N;
cout << "请输入正整数:";
cin >> M;

bool Lucky;
if (M % N == 0)
    Lucky = true;
else
    Lucky = false;
while (M){
    if (M % 10 == N && Lucky){
        printf("%d是%d的超级幸运数!", M, N);
        break;
    }
    M /= 10;
}
if (M == 0)
    if (Lucky)
        printf("%d是%d的幸运数!", M, N);
    else
        printf("%d非%d的幸运数!", M, N);
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析