mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 23:11:09 +00:00
Add GCD implementation (#371)
This commit is contained in:
parent
c0033f92ad
commit
a31d20acf5
12
Maths/gcd.py
Normal file
12
Maths/gcd.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
def gcd(a, b):
|
||||
if a == 0 :
|
||||
return b
|
||||
|
||||
return gcd(b%a, a)
|
||||
|
||||
def main():
|
||||
print(gcd(3, 6))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user