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

Popular posts from this blog

Write a python program to compute cumulative product of a list of numbers (write function cumulative_product).

Write a Python program to compute distance between two points taking input from the user. Formula for Pythagorean theorem for compute distance between two points is: