Skip to content
Home » Python Programs » Python Program to Find GCD of Two Numbers Using Function

Python Program to Find GCD of Two Numbers Using Function

Basic python program to find gcd of two numbers using function. In this python program we can execute the program to find gcd of two number.

Definition of GCD

The greatest common divisor (GCD) of two or more numbers is the exact divisor number that divides them. It’s also known as the greatest common factor (HCF). The greatest common divisor of two or more non-zero integers is the largest positive integer that divides each of the integers in mathematics.

Math.h function in Python

All Python functions begin with def, followed by the function name, and a comma-separated list of function arguments inside parentheses. There is only one argument C in this case. Within the function, this parameter serves as a standard variable. Inside the function, the statements that will be executed must be indented. Math function is important to execute the python program to find gcd of two numbers using function 

Python Program to Find GCD of Two Numbers Using Function

import math
print("The GCD of Number ", end="")
print(math.gcd(70, 40))

Output:

The GCD of Number 10