测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A17450. 运行程序,输出结果为?( )int cnt = 0; for(int n=2;n<=100;n++){ bool isPrime = true; for(int i=2;i*i<=n;i++){ if(n%i==0){ isPrime=false; break; } } if(isPrime) cnt++; } cout<<cnt;

单选题 中等

题目描述

运行程序,输出结果为?(    )

int cnt = 0;
    for(int n=2;n<=100;n++){
        bool isPrime = true;
        for(int i=2;i*i<=n;i++){
            if(n%i==0){
                isPrime=false;
                break;
            }
        }
        if(isPrime) cnt++;
    }
    cout<<cnt;

选项(单选)

上一题 下一题