package 高质量值得回味;
public class 求100到999之间满足该数的每位数字的阶乘之和等于该数的数是哪个数 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int bai, shi, ge;
for (int i = 100; i <= 999; i++) {
bai = i / 100;
shi = i / 10 % 10;
ge = i % 10;
if (i == jie(bai) + jie(shi) + jie(ge)) {
System.out.println("满足条件的是" + i);
}
}
}
private static int jie(int qq) {
// TODO Auto-generated method stub
int jie = 1;
for (int i = 1; i <= qq; i++) {
jie *= i;
}
return jie;
}
}
java求100到999之间满足该数的每位数字的阶乘之和等于该数的数是哪个数
最新推荐文章于 2023-11-27 10:57:20 发布