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