Write a Program to check if given number is Perfect number or not

This article will help you to understand Java program to check perfect number.

A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself.

Equivalently, a perfect number is a number that is half the sum of all of its positive divisors (including itself).

First Perfect number is 6. 1,2 and 3 are it’s proper positive divisors. And 1+2+3 = 6. Equivalently (1+2+3+6)/2 = 6

Java program to check perfect number

Output

Is number 28 a perfect number :- true Is number 50 a perfect number :- false
It's good to share...Share on FacebookTweet about this on TwitterShare on LinkedInPin on PinterestShare on Google+Email this to someone

Leave a Reply

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