/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package girmmaproject;

/**
 *
 * @author Admin
 */
import java.util.*;

public class Q20 {
        public static void main(String[] args) {
                System.out.println("Enter any number: ");
                Scanner input = new Scanner(System.in);
                int num = input.nextInt();
                int perfectNo = 0;
                int i;
                System.out.println("Factors are:");
                for (i = 1; i < num; i++) {
                        if (num % i == 0) {
                                perfectNo += i;
                                System.out.print(i+", ");
                        }
                }
                System.out.println();
                if (perfectNo == num) {
                        System.out.println(num+ " is  a perfect number");
                } else {
                        System.out.println(num+ " is not a perfect number");
                }
        }
}
