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