java中水仙花数

来源:互联网 发布:闲来麻将源码架设教程 编辑:程序博客网 时间:2024/06/10 07:49
public class Shui{
 public static void main(String args[]){
  
  for(int i=100;i<=999;i++){
   int b,s,g;
   b=i/100;
   s=(i-b*100)/10;
   g=i-b*100-s*10;
   if(i==b*b*b+s*s*s+g*g*g){
   System.out.println("all the ShuiXianhua number is :"+i);
   }
  
 }
   }
}
原创粉丝点击