BbJLeB

04. Equal Sums Even Odd Position

Jun 4th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. # 04. Equal Sums Even Odd Position
  2.  
  3. import math
  4.  
  5. n1 = int(input())
  6. n2 = int(input())
  7. x1 = 0
  8. x2 = 0
  9. x3 = 0
  10. x4 = 0
  11. x5 = 0
  12. x6 = 0
  13.  
  14. for i in range(n1, n2 + 1):
  15.     x1 = math.floor(i / 100000) % 10
  16.     x2 = math.floor(i / 10000) % 10
  17.     x3 = math.floor(i / 1000) % 10
  18.     x4 = math.floor(i / 100) % 10
  19.     x5 = math.floor(i / 10) % 10
  20.     x6 = i % 10
  21.     evenSum = x1 + x3 + x5
  22.     oddSum = x2 + x4 + x6
  23.     if evenSum == oddSum:
  24.         print(f"{i} ", end="")
Add Comment
Please, Sign In to add comment