JAVA-水仙花数

来源:互联网 发布:图片抽奖软件 编辑:程序博客网 时间:2024/05/16 10:38
public static void main(String[] args) {        // TODO 自动生成的方法存根        int i = 100;        while (i < 1000) {            int a, b, c;            a = i / 100;            b = i / 10 % 10;            c = i % 10;            if (i == a * a * a + b * b * b + c * c * c) {                System.out.println(i);            }            i++;        }    }
1 0