Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- start = int(input())
- end = int(input())
- magic =int(input())
- combinations = 0
- is_magic = False
- for i in range(start, end + 1):
- for j in range(start, end + 1):
- combinations += 1
- if i + j == magic:
- print(f"Combination N:{combinations} ({i} + {j} = {magic})")
- is_magic = True
- break
- if is_magic:
- break
- if not is_magic:
- print(f"{combinations} combinations - neither equals {magic}")
- Или:
- start = int(input())
- end = int(input())
- magic = int(input())
- combinations = 0
- for i in range(start, end + 1):
- for j in range(start, end + 1):
- combinations += 1
- if i + j == magic:
- print(f"Combination N:{combinations} ({i} + {j} = {magic})")
- exit(0)
- print(f"{combinations} combinations - neither equals {magic}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement