Perfect number

A number is called perfect if the number is equal to the sum of its divisors (the number itself is not considered a divisor in this case).

Check Perfect Number

import java.util.Scanner;

public class PerfectNumber {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int number, sum = 0;

		System.out.println("Enter a number to check for perfect: ");
		number = reader.nextInt();
		reader.close();

		for (int i = 1; i < number; i++) {
			if (number % i == 0) {
				sum = sum + i;
			}
		}

		if (sum == number) {
			System.out.print(number + " is a perfect number");
		} else {
			System.out.print(number + " is not a perfect number");
		}
	}
}
Output
Enter a number to check for perfect: 28
28 is a perfect number

Perfect Number List (1-n)

import java.util.Scanner;

public class PerfectNumberSeries {
	private static void checkPerfect(int max) {
		int number, min = 1, i, sum = 0;

		for (number = min; number <= max; number++) {
			sum = 0;
			for (i = 1; i < number; i++) {
				if (number % i == 0) {
					sum = sum + i;
				}
			}
			if (sum == number) {
				System.out.println(number + " is a perfect number");
			}
		}
	}

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int max;

		System.out.print("Enter the upper bound to find perfect numbers: ");
		max = reader.nextInt();
		reader.close();

		checkPerfect(max);
		
	}
}
Output
Enter the upper bound to find perfect numbers: 10000
6 is a perfect number
28 is a perfect number
496 is a perfect number
8128 is a perfect number