package javatute; import java.util.*; public class PerfectNumber { public static void main(String[] args) { int number = 0; System.out.println("Enter number"); Scanner input = new Scanner(System.in); int n = input.nextInt(); for (int i = 1; i < n; i++) { if (n % i == 0) { number += i; } } if (number == n) { System.out.println("number is a perfect "); } else { System.out.println("number is not perfect "); } } }