Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Python program to find GCD of two numbers

To write a Python program to find GCD of two numbers. 

# Python Program to find GCD of Two Numbers
a = float(input(” Please Enter the First Value a: “))
b = float(input(” Please Enter the Second Value b: “))
i = 1
while(i <= a and i <= b):
    if(a % i == 0 and b % i == 0):
        gcd = i
    i = i + 1

print(“\n GCD of {0} and {1} = {2}”.format(a, b, gcd))

OUTPUT:
Please Enter the First Value a: 12

Please Enter the Second Value b: 6

GCD of 12.0 and 6.0 = 6