Python Program to Find Perfect Number

Here we will write a program in Python to check whether the number is a Perfect number. So, first lets start with what is a perfect number.

What is a Perfect number:

Perfect Number is a number in which sum of all its positive divisors excluding that number is equals to the number.
For example:     6
Sum of divisors = 1+2+3 = 6

Step-wise Solution:

1. Take in an integer and store it in a variable.
2. Initialize a variable to count the sum of the proper divisors to 0.
3. Use a for loop and an if statement to add the proper divisors of the integer to the sum variable.
4. Check if the sum of the proper divisors of the number is equal to the variable.
5. Print the final result.
6. Exit.

Now lets write the code for the same.

Python Program to Find Perfect Number

OUTPUT:

Please comment for any suggestion or concerns.