September 2021 cohort is finalized with 45 amazing folks. For future cohorts Join the waitlist

GCD2 Solution



####
#	For python3
####

def gcd( a , b ):
	if b == 0:
		return a
	else:
		return gcd ( b , a % b )

t = int(input())

while t != 0:

	s = input()

	a , b = ( int(x) for x in s.split() )

	c = gcd(a,b)
	print(c)

	t = t - 1

470+ Competitive Programming Solutions

If you like what you read subscribe to my newsletter.

I write essays on various engineering topics and share it through my weekly newsletter 👇