Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

print perfect number in python

a=int(input("Give a number: "))
sum=0
for i in range(1,a):
  if a%i==0:
    sum=sum+i
if sum==a:
  print(a,"is a perfect number")
else:
  print(a,"is not a perfect number")
 
PREVIOUS NEXT
Tagged: #print #perfect #number #python
ADD COMMENT
Topic
Name
2+2 =