问题 单项选择题

下列程序执行的结果是( )。
public class Test
public static void main(String[ ] args)
int i, j, k;
for(int n=100; n<=200; n++ )
i = n/100;
j = n/10-i* 10;
k = n%10;
if(n == Math. pow(i, 3) + Math. pow(j, 3) + Math. pow(k, 3))
System. out. println(n);

A.153

B.167

C.173

D.137

答案

参考答案:A

解析: 题中实质是求100到200之间的水仙花数,一个数字个位、十位、百位上的数字的立方和与它的数值相等即为水仙花数。这个题目只有用结果选项去验证。其中A选项符合条件,1+125+27=153,所以选A。

单项选择题
填空题