Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import gcd
- def lcm(x, y):
- return (x * y) // gcd(x, y)
- num1 = int(input("Enter the first number: "))
- num2 = int(input("Enter the second number: "))
- gcd_result = gcd(num1, num2)
- lcm_result = lcm(num1, num2)
- # Print the results
- print("GCD of", num1, "and", num2, "is", gcd_result)
- print("LCM of", num1, "and", num2, "is", lcm_result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement