11智能在线
新记
while 循环求所有水仙花数
while 循环求所有水仙花数
举报该文章
其他看法
第1个回答 2017-12-05
while(x<1000)
{
a=x%10;
b=(x%100-a)/10;
c=(x-x%100)/100;
if(a*a*a+b*b*b+c*c*==x)
System.out.println(x); x++;
}
本回答被网友采纳
相似回答
大家正在搜
相关问题
分别使用while、do-while和for语句编程,找出所...
Java用while语句来找出所有的水仙花数
我刚学c++,能用while求出所有的水仙花数么?
求100-999的水仙花数 java 用while循环做
怎样加入for循环,使得输出数1000内所有的水仙花数
求1~1000水仙花数,使用do-while循环,不是whi...
while双重循环表示所有水仙花数,哪里出错了?
如何用while语句和do while语句列出所有水仙花数?