Perfect Number in Java

Here you will know about perfect number in Java with program and example.

What is Perfect Number?

The number said to be perfect number when sum of all positive divisors of that number excluding that number itself in divisors is equal to that number.

Or, sum of all positive divisors of that number including that number is 2 times of the number.

Key Points:

  • The number of divisors of perfect number will be even.
  • Most of the perfect numbers are even numbers.
  • Odd numbers are very rare in perfect numbers.
  • The digital root of all perfect numbers (except 6) is 1.


i) 28=2+8=10


ii) 496=4+9+6=19



This will be true for all perfect numbers.

Suppose take 6 is perfect number.

Positive divisors of 6 are 1, 2, 3, 6. We should exclude number in divisors so 6 we need to exclude. Then those divisors are called proper divisors.

Remaining numbers sum is 1+2+3=6

Number = sum of all proper positive divisors.



Number= ½(sum of all positive divisors).

Program for Perfect Number in Java


enter any positive number
28 is a perfect number

Leave a Comment

Your email address will not be published. Required fields are marked *