mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08: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