java水仙花数

public class demo_水仙花数 {
    public static void main(String [] args){
        for(int z = 100; z>=100&&z<1000; z++){
            int i=0;
            i=z/100;
            int j=z/10%10;
            int x=z/1%10;;

            if(j*j*j+i*i*i+x*x*x==z){
                System.out.println(z+"是水仙花数");

            }

        }




    }
}

猜你喜欢

转载自www.cnblogs.com/resort-033/p/12914082.html