java水仙花数
public class NarcissisticNumber {
public static void main(String[] args) {
for (int i = 100; i < 1000; i++) {
int hundredsDigit = i / 100;
int tensDigit = (i / 10) % 10;
int onesDigit = i % 10;
int sumOfCubes = (int) (Math.pow(hundredsDigit, 3) + Math.pow(tensDigit, 3) + Math.pow(onesDigit, 3));
if (sumOfCubes == i) {
System.out.println(i);
}
}
}
}