elcocodrilotito

Números perfectos

Nov 15th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. def num_perfecto(a):
  2.     s=0
  3.     for i in range(1,int(a/2)+1):
  4.         if a%i==0:
  5.             s=s+i
  6.     if s==a:
  7.         return True
  8.     else:
  9.         return False
  10. a=int(input("Numero perfecto: "))
  11. print(num_perfecto(a))
Add Comment
Please, Sign In to add comment