public class NumSplit {
public static void main(String[] args) {
int num = 100;
while(num<1000){
//求各位上的数
int gw = num % 10;
//求十位上的数
int sw = num / 10 % 10;
//求百位上的数
int bw = num / 100 % 10;
//求和
if( num == (gw*gw*gw) +(sw*sw*sw) +(bw*bw*bw)){
System.out.println(num);
}
num++;
}
}
}
public class test {
public static void main(String[] args){
int num=100,a,b,c;
System.out.println("所有的水仙花数:");
while(num++<1000){
a = num/100;
b = num/10%10;
c = num%10;
if(num == a*a*a+b*b*b+c*c*c){
System.out.println(num);
}
}
}
}
//纯手打,望采纳
int start=100,end=999;
while(start
int shiwei=(start-baiwei*100)/10;
int gewei=start%10;
if(start==这几个数的立方和){
输出
}
start++;
}