fork download
  1. def computeGCD(x,y):
  2. #"This function takes two integers and returns the GCD"
  3. # choose the smaller number
  4. if x > y:
  5. smaller = y
  6. else:
  7. smaller = x
  8. for i in range(1,smaller + 1):
  9. if((x % i == 0) and (y % i == 0)):
  10. gcd=i
  11. return gcd
  12. n1=input()
  13. n2=input()
  14. print computeGCD(n1,n2)
Success #stdin #stdout 0.02s 6932KB
stdin
8
12
stdout
4