program to find lcm of two Fibonacci numbers . given here are two positive nimbers a and b . the task is to print the lcm multiple of a' th and b' th Fibonacci numbers.
Answers
Answered by
0
Answer:
The product of two numbers is equal to the product of their GCD (Greatest Common Divisor) and LCM (Least Common Multiple).
a∗b=lcm∗gcd
This Python program is based on the above formula
a,b = map(int, input("Enter two positive integers: ").split())
print('LCM is',int(a*b/next(i for i in range(min(a,b),0,-1) if a%i==b%i==0)))
Just make sure one of the numbers isn't 0.
Output:
Enter two positive integers: 4 6
LCM is 12
Similar questions