标签:log print ann ring next i++ blog exti int
完全数:小于本身的所有因子的和(包括1)
public class test01 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n=scanner.nextInt(); for (int i=2;i<=n;i++){ int sum=0; for (int j=1;j<i;j++) if (i%j==0) sum+=j; if (sum==i) System.out.print(i+" "); } } }
标签:log print ann ring next i++ blog exti int
原文地址:http://www.cnblogs.com/tk55/p/6616658.html