Python program to find gcd of two numbers; In this tutorial, i am going to show you how to find GCD of two number or array elements.

**GCD** of two or more non-zero number is the largest number that divides both or more non-zero numbers. It is one of the basic concepts of mathematics.

## Python program to find the gcd of two numbers

Now, i will write simple python program to find gcd of two numbers; as shown below:

- Python program to find the GCD of two non-zero numbers
- Python program to find the GCD of the array Elements

### Python program to find the GCD of two non-zero numbers

- Get input numbers from user in program
- Include math module.
- Find gcd by using math.gcd() function and store result in variable.
- Print result.

#Python | Program to Find the GCD of the Array # import math module import math # input two numbers m,n=map(int,input('Enter two non-zero numbers: ').split()) #to find GCD g=math.gcd(m,n) # printing the result print('GCD of {} and {} is {}.'.format(m,n,g))

**Output**

Enter two non-zero numbers: 5 10 GCD of 5 and 10 is 5.

In the above python gcd program, you have learned to find the GCD of two non-zero number.

### Python program to find the GCD of the array Elements

#Python | Program to Find the GCD of the Array # importing the module import math # array of integers A=[100,150,250,150,170,110,195] #initialize variable b as first element of A b=A[0] for j in range(1,len(A)): s=math.gcd(b,A[j]) b=s print('GCD of array elements is {}.'.format(b))

**Output**

GCD of array elements is 5.

## Recommended Python Tutorials

**Recommended:-**Python Program to Calculate Simple Interest

**Recommended:-**Python Program to Find Average of n Numbers

**Recommended:-**Python Program to ASCII Value of Character

**Recommended:-**Python Program to Calculate Compound Interest

**Recommended:-**Python Program to Check Leap Year

**Recommended:-**Python Program To Print Number Pattern

**Recommended:-**Python Program to Print Star Pattern

**Recommended:-**Python Program Calculate Sum of n Numbers

**Recommended:-**Python Program to Reverse Numbers

**Recommended:-**Python Program to Find Largest of n Numbers

**Recommended:-**Python Program to Find Power of Number

**Recommended:-**Python Program to Print Prime Number From 1 to N

**Recommended:-**Python Program to Find Square Root of Number

**Recommended:-**Python Program to Find Cube of Number

**Recommended:-**Python Palindrome Program

**Recommended:-**Python Program to Count Set Bits in a Number

**Recommended:-**Python Program for BMI Calculation

**Recommended:-**Python Program to Find Out Absolute Value

**Recommended:-**Python Random Number Generator Code