class Title2
{
public static void main(String[] args)
{
for (int num = 100; num < 1000; num++)
{
int b = num / 100;
ints = num / 10 % 10;
intg = num % 10;
if (b*b*b+s*s*s+g*g*g == 100*b+10*s+g)
System.out.println("打印出的水仙花数有:"+ num);
}
for (int num = 1000; num < 10000; num++)
{
int q = num / 1000;
int b = num / 100 % 10;
int s = num / 10 % 10;
int g = num % 10;
if (q*q*q+b*b*b+s*s*s+g*g*g == 1000*q+100*b+10*s+g)
System.out.println("打印出的四叶玫瑰数有:"+ num);
}
}
}
我哪里错了?
|
|