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

A50454. 下面程序的功能是输出100到1000中的水仙花数。则在空白处应填入( )。说明:若一个三位数的每一位数字的立方之和该数本身则称这个数为水仙花数。例如:因为153 = 1×1×1+5×5×5+3×3×3,所以153为水仙花数。#include <iostream>#include <cmath>using namespace std;int main(){ int a,b,c; for (int …

单选题 较易

题目描述

下面程序的功能是输出100到1000中的水仙花数。则在空白处应填入(    )。

说明:若一个三位数的每一位数字的立方之和该数本身则称这个数为水仙花数。例如:因为153 = 1×1×1+5×5×5+3×3×3,所以153为水仙花数。

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

   int a,b,c;

    for (int n = 100; n <= 999; n+=1) {

        _______

        _______

        _______

        if(pow(a,3)+pow(b,3)+pow(c,3)==n){

            cout <<n <<"是水仙花数"<<endl;

        }

    }

    return 0;

}

选项(单选)

上一题 下一题