Write a python program to compute GCD, LCM of two numbers (Each function shouldn’t exceed one line use predefined module).
from math import gcd
def gcd1(a,b):
return gcd(a,b)
def lcm1(a,b):
return a*b//gcd(a,b)
a=int(input("Enter the value of a"))
b=int(input("Enter the value of b"))
print("The gcd of two numbers is",gcd1(a,b))
print("The lcm of two numbers is",lcm1(a,b))
Comments
Post a Comment