I am trying to find the GCD of 3 numbers but have been unable to get around much success till now. I am using the following code
def gcd(a, b,c):
if sum(np.array(list([a,b,c]))%min(a,b,c))==0:
return min(a,b,c)
else:
x = np.array(list([a,b,c]))%min(a,b,c)
if sum((list([x]))%min(x))==0:
return min(x)
When I run this on an example say gcd(21,45,60), it gives me the below error
C:\Users\mmt8091\Anaconda3\lib\site-packages\ipykernel_launcher.py:6: RuntimeWarning: divide by zero encountered in remainder
What am i doing wrong here? Have been unable to find any other solutions on net as well. Please help