Explanation
A perfect number is a number that is half the sum of all of its positive divisors (including itself) i.e. ?1(n) = 2n. Hence, run a for loop and keep adding the those number which is an exact divisor of given number and finally if the sum is equal to the given number itself then the given number is a perfect number.
Help Others Find This
❤️ Liked this article?
If it saved you time, consider buying me a coffee to support future improvements.