Python program to find GCD of Two Numbers

num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
i = 1while(i <= num1 and i <= num2):
  if(num1 % i == 0 and num2 % i == 0):
    gcd = i
  i = i + 1
print("GCD is", gcd)

OUTPUT:

Input:
5
15
Output:
5

Sharing Is Caring

Leave a Comment