perfect number program using python
Perfect number, a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers are 28, 496, and 8,128.
source code
# enter number is perfect or not
num = int (input("enter the number : "))
add=0
for i in range (1,num):
if(num%i==0):
add=add+i
if num==add:
print(f"{num} is profect number ")
else:
print (f"{num} is not profect number ")
No comments:
Post a Comment