write a program to input a number from user and that program determines whether a number is a perfect number or not.
write properly or else I will report your answer
Answers
Answered by
1
Answer:
not sure if all right but what i know is this
Explanation:
def is_perfect_number(n):
sum = 1
i = 2
while i * i <= n:
if n % i == 0:
sum = sum + i + n/i
i += 1
return (True if sum == n and n!=1 else False)
num = int(input(“Enter a number : “))
if(is_perfect_number(num)):
print(num,”is a perfect number”)
else:
print(num,”is not a perfect number”)
Similar questions
Math,
3 days ago
Math,
6 days ago
Math,
6 days ago
Hindi,
8 months ago
Social Sciences,
8 months ago