无聊的时候做了一个水仙花数
水仙花数为输入数字的每一位的三次方相加等于这个数的话就是水仙花数
Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int b=a/100%10; int c=a/10%10; int d=a%10; if (b*b*b+c*c*c+d*d*d==a) { System.out.println(a+"是水仙花数"); }