Advertisement
vmeansdev

Recursive gcd

Nov 28th, 2019
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. def gcb(a, b):
  2.     if b != 0:
  3.         if a > b:
  4.             return gcb(b, a % b)
  5.         elif a < b:
  6.             return gcb(a, b % a)
  7.     return a
  8.  
  9.  
  10. a = int(input())
  11. b = int(input())
  12.  
  13. print(gcb(a, b))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement