this is a simple implementation of the euclidian algorithm but it always returns None The sample input is A=270 and B = 192 should return 6 I am not neccesarily looking for code just an explaination on why it returns none instead of an integer. Thanks
Code:
def GCD(a, b):
if a == 0:
print("B") # for debugging
return int(b)
elif b == 0:
print("A") # for debugging
return int(a)
else:
GCD(int(b), int((a%b))) # recursive function call
print(GCD(int(input("A:")),int(input("B:"))))
Output:
A:270
B:192
A
None