diff --git a/Maths/fibonacciSeries.py b/Maths/FibonacciSequenceRecursion.py similarity index 100% rename from Maths/fibonacciSeries.py rename to Maths/FibonacciSequenceRecursion.py diff --git a/Maths/GreaterCommonDivisor.py b/Maths/GreaterCommonDivisor.py new file mode 100644 index 000000000..15adaca1f --- /dev/null +++ b/Maths/GreaterCommonDivisor.py @@ -0,0 +1,15 @@ +# Greater Common Divisor - https://en.wikipedia.org/wiki/Greatest_common_divisor +def gcd(a, b): + return b if a == 0 else gcd(b % a, a) + +def main(): + try: + nums = input("Enter two Integers separated by comma (,): ").split(',') + num1 = int(nums[0]); num2 = int(nums[1]) + except (IndexError, UnboundLocalError, ValueError): + print("Wrong Input") + print(f"gcd({num1}, {num2}) = {gcd(num1, num2)}") + +if __name__ == '__main__': + main() + diff --git a/Maths/gcd.py b/Maths/gcd.py deleted file mode 100644 index 0f0ba7dce..000000000 --- a/Maths/gcd.py +++ /dev/null @@ -1,12 +0,0 @@ -def gcd(a, b): - if a == 0 : - return b - - return gcd(b%a, a) - -def main(): - print(gcd(3, 6)) - - -if __name__ == '__main__': - main()