package lianxi; public class Print { void getShuiXianHuaShu() { int a; for (int i = 1; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { if ((i * 100 + j * 10 + k) == (i * i * i + j * j * j + k * k * k)) { a = i * 100 + j * 10 + k; System.out.println(a); } } } } } public static void main(String[] args) { Print ShuiXianHuaShu = new Print(); ShuiXianHuaShu.getShuiXianHuaShu(); } }
转载于:https://www.cnblogs.com/wenwen123/p/5501568.html