Advertisement
Guest User

Sum of Two Nums

a guest
Dec 10th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. a = int(input())
  2. b = int(input())
  3. c = int(input())
  4. cnt = 0
  5. flag=False
  6. for i in range(a, b + 1):
  7.     for j in range(a, b + 1):
  8.         cnt += 1
  9.         if i + j == c:
  10.             print(f'Combination N:{cnt} ({i} + {j} = {c})')
  11.             flag=True
  12.             break
  13.     if flag:
  14.         break
  15.  
  16. if cnt == (b - a + 1) **2:
  17.     print(f'{cnt} combinations - neither equals {c}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement