The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Perfect number finder
By Guest on 10th February 2019 07:34:27 PM | Syntax: PYTHON | Views: 21



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. for number in range (1 , int(input('state the maximum number')) + 1):
  2.     sum = 0
  3.     for divisor in range (1 , int(number/2) + 1):
  4.         if number % divisor == 0:
  5.             sum += divisor
  6.     if sum == number:
  7.         print (number)



  • Recent Pastes