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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Python Program to Find Perfect Number n = int(input("Enter any number: ")) sum1 = 0 for i in range(1, n): if(n % i == 0): sum1 = sum1 + i if (sum1 == n): print("The number is a Perfect number!") else: print("The number is not a Perfect number!") |

### OUTPUT:

1 2 3 4 5 6 | Enter any number: 6 The number is a Perfect number! |

Please comment for any suggestion or concerns.