public class Text1 { //一个数如果恰好等于它的因子之和,这个数就称为 "完数 "。 // 例如6=1+2+3.编程 找出1000以内的所有完数 public static void main(String[] args) { for(int i=1; i<1000;i++){ int num=0; for(int j=1; j<i;j++){ if (i%j==0){ num+=j; } } if (i==num){ System.out.println(i); } } } }
04-23
3292
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交