Find whether the given number is perfect - Java Quiz Question


Write a program to check whether the given number is perfect. The number is said to be perfect if the sum of its factors is equal to (2 * number). For e.g., 6 -> 1 + 2 + 3 + 6 = (2 * 6).

Input (int) Output (boolean)
6 true
20 false
28 true
13 false



class IsPerfectNumber
{
    public static void main(String s[])
    {
        int number = 28;
        System.out.println("The given number is perfect Number : " + isPerfectNumber(number));

    }


    public static boolean isPerfectNumber(int number) {
    }

}