Advertisement
Nenogzar

Untitled

Oct 15th, 2023
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. n = int(input())
  2. found = False
  3.  
  4. for a in range(1, 10):
  5.     for b in range(9, a - 1, -1):
  6.         for c in range(0, 10):
  7.             for d in range(9, c - 1, -1):
  8.                 if (a + b + c + d) == (a * b * c * d) and (a + b + c + d) % 10 == 5:
  9.                     print(f"{a}{b}{c}{d}")
  10.                     found = True
  11.                     break
  12.                 if (a * b * c * d) // (a + b + c + d) == 3 and n % 3 == 0:
  13.                     print(f"{d}{c}{b}{a}")
  14.                     found = True
  15.                     break
  16.             if found:
  17.                 break
  18.         if found:
  19.             break
  20.     if found:
  21.         break
  22.  
  23. if not found:
  24.     print("Nothing found")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement