所谓的水仙花数:例如153=111+555+333
package swithdemo;
public class ForTest4 {
public static void main(String[] args) {
int count = 0;
//水仙花数
for (int i = 100; i < 999; i++) {
int ge = i % 10;
int shi = i / 10 % 10;
int bai = i / 100;
if (bai * bai * bai + ge * ge * ge + shi * shi * shi == i) {
System.out.print(i + "\t");
count++;
}
}
System.out.println("\n");
System.out.println(count);
}
}