public class wsxhs02 {
public static void main(String[] args) {
System.out.println("程序开始");
int sxhs = 0;
int j = 100;
while (j <= 999){
j++;
int ge = j % 10;
int shi = j / 10 % 10;
int bai = j /10 / 10 % 10;
if (ge*ge*ge + shi*shi*shi + bai*bai*bai == j){
sxhs ++;
}
}
System.out.println("水仙花的数量是" + sxhs + "个");
}
}
java 水仙花数的个数程序
最新推荐文章于 2024-11-15 18:38:47 发布