Skip to content

Commit 1a4962a

Browse files
committed
Refactor gdc and rename two files GreaterCommonDivisor and FibonnaciSequenceRecursive
1 parent e03426b commit 1a4962a

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed
File renamed without changes.

Maths/GreaterCommonDivisor.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Greater Common Divisor - https://en.wikipedia.org/wiki/Greatest_common_divisor
2+
def gcd(a, b):
3+
return b if a == 0 else gcd(b % a, a)
4+
5+
def main():
6+
try:
7+
nums = input("Enter two Integers separated by comma (,): ").split(',')
8+
num1 = int(nums[0]); num2 = int(nums[1])
9+
except (IndexError, UnboundLocalError, ValueError):
10+
print("Wrong Input")
11+
print(f"gcd({num1}, {num2}) = {gcd(num1, num2)}")
12+
13+
if __name__ == '__main__':
14+
main()
15+

Maths/gcd.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)