Python GCD Recursive Function – Write a Python Program to find GCD of two numbers by recursion.

**Python GCD Recursive Function**

Python Program GCD of Two Numbers

# Write a Python Program to find GCD # of two numbers using Recursion # define a recursive GCD function def recursive_gcd(a,b): if(b==0): return a else: return recursive_gcd(b,a%b) # main # input two integer numbers a=int(input("Enter first number:")) b=int(input("Enter second number:")) # call recursive function gcd=recursive_gcd(a,b) # print GCD print("GCD is: ", gcd)

Output

Enter first number:40

Enter second number:230

GCD is: 10

You will also like:

### Python Recursion With Example Recursive Function

- C Program Sum of One to N by Recursion
- C Program Sum of Digits by Recursion
- C Program Reverse Number by Recursion
- C Program Fibonacci Series by Recursion
- C Program Power By Recursion
- C Program Find Factorial by Recursion
- C Program Quick Sort
- C Program Merge Sort

- Using Recursion in Java Find Factorial of Number
- Recursion in Java Explained With Examples
- Program Factorial by Loop and Recursion Versions

99 total views, 1 views today