您的位置:首页 > 其它

输出100-999之间所有的水仙花数

2016-06-23 21:49 260 查看
//7.输出100-999之间所有的水仙花数

public class P7 {

 public static void main(String[] args) {

  for(int x=100;x<=999;x++){

   int a=x/100;

   int b=x/10%10;

   int c=x%10;

   if(x==a*a*a+b*b*b+c*c*c){

    System.out.println(x);

   }

  }

  // TODO Auto-generated method stub

 }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: