Topic: Print out all the "daffodil numbers". The so-called "daffodil number" refers to a three-digit number whose cube sum is equal to the number itself. For example: 153 is a "daffodil number", because 153 = 1 cube + 5 cube + 3 cube.
public class NarcissisticNumber{
public static void main(String[] args) {
int b1, b2, b3;
for(int m=101; m<1000; m++) {
b3 = m / 100;
b2 = m % 100 / 10;
b1=m %10;
if((b3*b3*b3 + b2*b2*b2 + b1*b1*b1) == m){
System.out.println(m+"是一个水仙花数");
}
}
}
}