public class testB {
public static void main(String[] args) {
// TODO Auto-generated method stub
for (int i = 1; i <= 1000; i++) {
// 调用func函数
if (i == func(i))
System.out.println(i);
}
}
// 创建func函数
public static int func(int num) {
int sum = 0;
do {
sum = sum + (num % 10) * (num % 10) * (num % 10);
num = num / 10;
} while (num != 0);
return sum;
}
}
|
|