#challenge



💻 Perfect Number | #easy



Create a function that tests whether or not an integer is a perfect number. A perfect number is a number that can be written as the sum of its factors, (equal to sum of its proper divisors) excluding the number itself.



For example, 6 is a perfect number, since 1 + 2 + 3 = 6, where 1, 2, and 3 are all factors of 6. Similarly, 28 is a perfect number, since 1 + 2 + 4 + 7 + 14 = 28.



Examples:



CheckPerfect(6) ➞ true

CheckPerfect(28) ➞ true

CheckPerfect(496) ➞ true

CheckPerfect(12) ➞ false

CheckPerfect(97) ➞ false



🏆 Leave your solutions in the comments. The solution will be posted below in a couple of hours 👇



#interview