/* 输出所有的水仙花数,所谓水仙花数是指一个3位数,其各个位上数字立方和等于其本身。 例如:153 = 1*1*1 + 3*3*3 + 5*5*5 */
class ForTest2{
public static void main(String[] args){
for(int i = 100;i <= 999;i++){
int a = i / 100; //获取百位
int b = i % 100 /10; //获取十位
int c = i % 10; //获取个位
if(a*a*a + b*b*b + c*c*c == i){
System.out.println("此数值为满足条件的水仙花数:" + i);
}
}
}
}