My issue
My code
# solution as follows
import math
t = int(input())
for i in range(t):
n,m=map(int,input().split())
ans=math.gcd(n,m)
print(ans)
Learning course: Python for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone
Hi Heyanonymouse77, You just have to get the greatest common divisor.
You can refer the below code:
# Solution
import math
def calcGCD(n, m):
print(n, m)
return n if m==0 else calcGCD(m, n%m)
t = int(input())
for i in range(t):
n,m = map(int, input().split())
ans = calcGCD(n, m)
print(ans)