Guest User

Untitled

a guest
Nov 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. a = int(input())
  2. b = int(input())
  3. c = int(input())
  4. d = int(input())
  5. i = 0
  6.  
  7. def nod(n,m):
  8. while (n != 0) and (m != 0):
  9. if n > m:
  10. n = n % m
  11. else:
  12. m = m % n
  13. return(n + m)
  14.  
  15. while a < c and b < d:
  16. a += 1
  17. b += 1
  18. i += 1
  19. if a == c and b == d:
  20. break
  21. a = a / nod(a,b)
  22. b = b / nod(a,b)
Add Comment
Please, Sign In to add comment