Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- n = int(input())
- found = False
- for a in range(1, 9):
- if not found:
- for b in range(9, a, -1):
- if not found:
- for c in range(0, 9):
- if not found:
- for d in range(9, c, -1):
- if not found:
- if (a + b + c + d) == (a * b * c * d) and n % 10 == 5:
- print((a * 1000) + (b * 100) + (c * 10) + d)
- found = True
- break
- if math.floor(((a * b * c * d) / (a + b + c + d))) == 3 and n % 3 == 0:
- print((d * 1000) + (c * 100) + (b * 10) + a)
- found = True
- break
- if not found:
- print("Nothing found")
Advertisement
Add Comment
Please, Sign In to add comment