水仙花数

package asda;
import java.util.Scanner;
public class Main
{
    public static void main(String[] args)
    {
        int i = 100;
        for(; i<=999; ++i)
        {
            int a = i / 100;
            int b =i % 100 / 10;
            int c = i % 10;
            if(a*a*a+b*b*b+c*c*c == i)
                System.out.println(i);
        }
    }
}

 

posted @ 2016-10-13 14:12  默问柳  阅读(101)  评论(0编辑  收藏  举报