class TestWanShu { public static void main(String[] args) { int factor = 0; for(int i = 1; i<=1000;i++){ for(int j = 1; j<i; j++){ if(i % j == 0){ factor += j; } } if(i == factor){ System.out.println(i); } factor = 0; } } }
原文地址:http://9815936.blog.51cto.com/9805936/1600792