public class shuixian {
public static void main(String[] args) {
// 定义变量count,用于保存水仙花的数量,初始值为0
int count = 0;
// 遍历所有的三位数,从100开始,999结束
for (int i = 100; i < 1000; i++) {
int ge = i % 10;
int shi = i / 10 % 10;
int bai = i / 10 / 10 % 10;
if (ge * ge * ge + shi * shi * shi + bai * bai * bai == i) {
count++;
}
}
System.out.println("水仙花共有:" + count + "个");
}
}