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 + " "); } } }
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 + " "); } } }