public class Solution { public static void main(String[] args) { int sum; for(int i = 6; i < 10000; i++) { sum = 0; for(int j = 1; j < i; j++) if(i % j == 0) sum += j; if(sum == i) System.out.print(i + " "); } } }
相关文章
- 09-09HW4.33
2022-09-09 20:43:50
public class Solution { public static void main(String[] args) { int sum; for(int i = 6; i < 10000; i++) { sum = 0; for(int j = 1; j < i; j++) if(i % j == 0) sum += j; if(sum == i) System.out.print(i + " "); } } }