class Demo1
{
public static void main(String[ ] args)
{
for (int x=100;x<=999 ;x++ )
{
int bai=x/100;
int shi=(x-num*100)/10;
int ge=(x-num*100-z*10);
int b=bai*bai*bai+shi*shi*shi+ge*ge*ge;
if (b==x)
{
System.out.println("b="+b);
}
}
}
class ShuiXianHuaShu{
public static void main(String[] args) {;
for(int i=100;i<=1000;i++){
int n=i;
int m=n;
int sum =0;
while(n!=0){
int last=n%10;
sum =sum+last*last*last;
n/=10;
}
if(sum==m){
System.out.println(m+"是水仙花数!");
}
}
}
}
这个绝对没问题!