class ShuiXianHua {
public static void main(String[] args) {
int sum = 0;
for (int x = 100; x < 1000; x++) {
int ge = x % 10;
int shi = x / 10 % 10;
int bai = x / 10 / 10 % 10;
if (x == (ge * ge * ge + shi * shi * shi + bai * bai * bai)) {
System.out.println(x);
sum++;
}
}
System.out.println("水仙花数一共有:"+sum);
}
}
|