标签:
/** * 求水仙花数 * @param left * @param right */ static void checkFlowerNumber(int left,int right){ for (int i = left; i <= right; i++) { char[] ch = (i+"").toCharArray(); int sum = 0; int num = 0; for (int j = 0; j < ch.length; j++) { num = Integer.parseInt(ch[j]+""); sum += num*num*num; } if (sum == i) { System.out.println(i); } } }
标签:
原文地址:http://www.cnblogs.com/phyxis/p/5192928.html