public class Test07 {
public static void main(String[] args) {
//求1000以内的水仙花数(一个三位数,个十百位每位数的立方和等于该数本身)
int g, s, b;
int count = 0;
for (int i = 100; i < 1000; i++) {
//百位
b = i / 100;
//十位
s = i % 100 / 10;
//个位
g = i % 10;
if (b * b * b + s * s * s + g * g * g == i) {
count++;
System.out.println(i);
}
}
System.out.println("1000以内的水仙花个数:" + count++);
}
}