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;
}
选项(单选)
答案解析
详细答案解析为会员权益,按每日次数查看。
开通 / 升级会员
上一题
下一题