[19922 views]
Perfect number is a positive integer equal to the sum of its proper divisors. Sum of its proper divisor excludes the Number itself. Ex. For number 6, the divisors are 1, 2, 3 and 6. Now if we take sum of 1, 2, 3 and exclude the number itself (i.e. 6), the sum is 6. Hence, 6 is a perfect number. 6 is the smallest Perfect Number.
Let's check another number:
Input: 28
Divisors of 28: 1, 2, 4, 7, 14, 28
Sum of Divisors excluding 28: 1+2+4+7+14=28
Output: 28 is Perfect Number