标签:ring oid pow mat dem main auth out 语言
package com.llh.demo;
/**
* 水仙花数
* @author llh
*
*/
public class Demo14 {
public static void main(String[] args) {
for (int i = 100; i <= 999; i++) {
//取出每一位上的数
int gum, sum, bum,num;
bum = i/100;
sum =(i-bum*100)/10;
gum =i-bum*100-sum*10;
num=(int) (Math.pow(gum,3) + Math.pow(sum,3) + Math.pow(bum,3));
if (i == num) {
System.out.println(i);
}
}
}
}
标签:ring oid pow mat dem main auth out 语言
原文地址:http://www.cnblogs.com/javallh/p/7242893.html