//水仙花数是指:一个三位数,其各位数字的立方和等于该数本身
//例如:153就是一个水仙花数。
//153 = 1*1*1 + 5*5*5 + 3*3*3 = 1 + 125 + 27 = 153
public class ShuiXianHuaShu {
public static void main(String[] args) {
int count = 0;
for (int i = 100; i < 1000; i++) {
int ge = i % 10;
int shi = i / 10 % 10;
int bai = i / 100 % 10;
if (i == ge * ge * ge + shi * shi * shi + bai * bai * bai) {
System.out.println(i + "是水仙花数");
count++;
}
}
System.out.println("一共有" + count + "个水仙花数");
}
}