package studying; import java.util.Scanner; public class End_Count { public static void main(String[] args) { System.out.println("多少范围内的完数?请输入:"); Scanner input = new Scanner(System.in); int n = input.nextInt(); int i,j,k; for(i = 1; i<=n; i++) { k =0; for(j =1; j<=i-1; j++) if(i%j == 0) k+=j; if(k == i) System.out.print(i + " "); } System.out.println(" The end!"); } }