[9] the number of complete program requirements 9
Title: If a number is exactly equal to the sum of its factors, this number is called "count them." E.g. 6 = 1 + 2 + 3. After programming to find all the numbers less than 1000.
package cskaoyan; public class cskaoyan9 { @org.junit.Test public void perfectNumber() { int sum = 0; int number = 1000; for (int i = 2; i <= number; i++) { for (int j = 1; j < i; j++) { if (i % j == 0) { sum += j; } } if (sum == i) { System.out.println(sum); } sum = 0; } } }