Content-Length: 274466 | pFad | http://github.com/farhanjaved47/python/commit/46853a7a1894163a1d7312e4814b39de0a24a453

93 Find Greatest Common Divisor using Euclid's algorithm · farhanjaved47/python@46853a7 · GitHub
Skip to content

Commit 46853a7

Browse files
committed
Find Greatest Common Divisor using Euclid's algorithm
1 parent 7fce37e commit 46853a7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

GCD.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Farhan Javed
3+
farhan.javed47@gmail.com
4+
12/09/2019
5+
Find the greatest common divisor using Euclid's algorithm
6+
"""
7+
8+
9+
def gcd(a, b):
10+
while b != 0:
11+
t = a
12+
a = b
13+
b = t % b
14+
return a
15+
16+
17+
def main():
18+
print(gcd(12, 4))
19+
print(gcd(60, 96))
20+
print(gcd(20, 8))
21+
22+
23+
if __name__ == '__main__': main()

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/farhanjaved47/python/commit/46853a7a1894163a1d7312e4814b39de0a24a453

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy