这个题我发过~给你个更简单的~- public class ShuiXianHua
- {
- public static void main(String[] args)
- {
- for(int i=1; i<=10000; i++)
- {
- int a = i/100;
- int b = i/10%10;
- int c = i%10;
- if(Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3)==i)
- System.out.println(i+"是水仙花数");
- }
- }
- }
复制代码 |
|