Advertisement
BbJLeB

09. Sum of Two Numbers

Jun 7th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # 09. Sum of Two Numbers
  2.  
  3. startingNumber = int(input())
  4. finalNumber = int(input())
  5. magicNumber = int(input())
  6. combinations = 0
  7. i = 0
  8. for i in range(startingNumber, finalNumber):
  9.     i += 1
  10.     for j in range(startingNumber, finalNumber):
  11.         j+=1
  12.         combinations += 1
  13.         if i + j == magicNumber:
  14.             break
  15.             print(f"Combination N:{combinations} ({i} + {j} = {magicNumber})")
  16.        
  17. print(f"{combinations} combinations - neither equals {magicNumber}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement