A perfect number is a positive integer where the sum of all its positive divisors, except itself, is equal to the number itself.
For example 6 is a perfect number as 1,2 and 3 are its divisors and the sum of divisors=1+2+3=6. Here we have created a program that will take the number from the user and reports whether it is perfect or not.
6= 1+2+328= 1+2+4+7+14496= 1+2+4+8+16+31+62+124+248
Check if a given Number is Perfect Number:
When you run the program, the output will be:
Enter Positive Integer28Number is Perfect