fork download
  1. a = int(input())
  2. b = int(input())
  3.  
  4. while a != 0 and b != 0:
  5. if a > b:
  6. a %= b
  7. else:
  8. b %= a
  9.  
  10. gcd = a + b
  11. print(gcd)# your code goes here
Success #stdin #stdout 0.01s 7244KB
stdin
12
18
stdout
6