Skip to content

Commit

Permalink
Fix Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTagintsev committed Sep 29, 2018
1 parent bcdfcab commit 7a9de12
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions gcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ def gcd(a, b):
assert a >= 0 and b >= 0
while a and b:
if a > b:
a = a / b
break
a = a % b
else:
b = b / a
break
return min(a, b)
b = b % a
return a + b

print(gcd(10, 0))

Expand All @@ -18,4 +16,4 @@ def gcd(a, b):
# gcd(10, 0) => 10
# gcd(123, 3) => 3
# gcd(1000000, 64) => 64
# gcd(0, 0) => 0
# gcd(0, 0) => 0

1 comment on commit 7a9de12

@IgorTagintsev
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fixed

Please sign in to comment.