Computer Science, asked by Zohda234, 4 months ago

write a program to input a number and check out it is perfect number or not. A perfect number is that whose sum of factors excluding that number would be equal to that number only
Ex: 28 = 1+2+4+7+14 = 28​

Answers

Answered by stunning006
1

Answer:

def perfect_number(n):

sum = 0

for x in range(1, n):

if n % x == 0:

sum += x

return sum == n

print(perfect_number(6)

Similar questions