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