public class 水仙花数 { public static void main(String[] args) { for (int i = 100; i < 1000; i++) { int a = i % 10; int b = i / 100; int c = i / 10 % 10; if (a*a*a+b*b*b+c*c*c==i) { System.out.println(i); } } } }…
/* 在控制台输出所有的“水仙花数” 水仙花:100-999 在以上数字范围内:这个数=个位*个位*个位+十位*十位*十位+百位*百位*百位 例如:xyz=x^3 +y^3 +z^3 怎么把三位数字拆成每位整数 思路:百位: int x= i / 100 十位: int y = i / 10 % 10 个位: int z = i % 10 */ class LoopTest3 { public static void main(String[] args) { for (int i=100; i…