- 1
phyton
What would happen if we call gcd(m,n) with m positive and n negative in the following definition? def gcd(m,n): if m < n: (m,n) = (n,m) if (m % n) == 0: return(n) else: diff = m-n return (gcd(max(n,diff),min(n,diff)))
1 Answer
0
Hi, the best way to know it is to try it, but if you want to make sure a number is positive, use abs(number)