def perfectNumber(number):
sum = 0
for x in range(1, number):
if number % x == 0:
sum += x
return sum == number
if __name__ == '__main__':
n=int(input("Enter a number to check : "))
print(perfectNumber(n))
#clcoding.com
Enter a number to check : 6 True
0 Comments:
Post a Comment