Write a Python Program to check if a number is a Perfect number and print the result
Topic: Write a Python Program to check if a number is a Perfect number and print the result
Solution
n = 7 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!")
List all Python Programs