Math, asked by baradisaanvireddy200, 1 month ago

write a python program
The greatest common divisor (also known as greatest common factor, highest common divisor or highest common factor) of a set of numbers is the largest positive integer number
that divides all the numbers in the set without remainder. It is the biggest multiple of all numbers in the set
Take two integers x and y as input from the console using input() function. Write a program to find the GCD of given inputs x and y, print the result to the console as shown
in the example.​

Answers

Answered by nanub
0

def gcd(x, y):

if x > y:

smaller = y

else:

smaller = x

for i in range(1, smaller+1):

if((x % i == 0) and (y % i == 0)):

hcf = i

return hcf

num1= int(input("Enter first number: "))

num2= int(input("Enter second number: "))

print("The G.C.D. is", gcd(num1, num2))

Similar questions