From f05e6aba82cf0367ada93dc53d8858a25188ea3b Mon Sep 17 00:00:00 2001 From: Phantsure Date: Tue, 2 Oct 2018 15:44:24 +0530 Subject: [PATCH] Create euclidean_algo_GCD_basic.py basic GCD implementation --- Mathematics/euclidean_algo_GCD_basic.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Mathematics/euclidean_algo_GCD_basic.py diff --git a/Mathematics/euclidean_algo_GCD_basic.py b/Mathematics/euclidean_algo_GCD_basic.py new file mode 100644 index 000000000..1a1cd6987 --- /dev/null +++ b/Mathematics/euclidean_algo_GCD_basic.py @@ -0,0 +1,11 @@ +# Python program to demonstrate Basic Euclidean Algorithm +# Function to return gcd of a and b +def gcd(a, b): + if a == 0 : + return b + return gcd(b%a, a) + +# example with 2 numbers which could be taken as input also +a = 10 +b = 15 +print(gcd(a, b))