// Question: print out all the "Daffodils". The so-called "Daffodils" refers to a three-digit number, each of which is a number cube and equals to the number itself.
// For example, 153 is a "Daffodils" because 153 = the power of 1 + the power of 5 + the power of 3.
// Program analysis: Use the for loop to control the number of 100-999. Each number is used to calculate a single digit, ten digits, and hundreds of digits.
Package WZS. arithmetics; // Title: print all "Daffodils". The so-called "Daffodils" refers to a three-digit number, each of which is equal to the number itself. // For example, 153 is a "Daffodils" because 153 = the power of 1 + the power of 5 + the power of 3. // Program analysis: Use the for loop to control the number of 100-999. Each number is used to calculate a single digit, ten digits, and hundreds of digits. Public class test_wzs3 {public static void main (string [] ARGs) {for (INT I = 100; I <999; I ++) {If (test_wzs3.f (I )) {system. out. print (I + ",") ;}} public static Boolean F (INT number) {If (number <100 | number> 999) {system. out. println ("Enter three digits. "); Return false;} int A, B, C; // a hundred digits, B ten digits, C one digit A = Number/100; B = (Number % 100) /10; C = Number % 10; If (number = A * a * A + B * B * B + C * c) {return true ;} else {return false ;}}}