WAP in python
to input
two numbers and
print their L.C.M and
G.C.D
Answers
Answered by
0
Answer:
1. Take in both the integers and store it in separate variables.
2. Find which of the integer among the two is smaller and store it in a separate variable.
3. Use a while loop whose condition is always True until break is used.
4. Use an if statement to check if both the numbers are divisible by the minimum number and increment otherwise.
5. Print the final LCM.
6. Exit.
Answered by
0
Answer:
Hey! Here is your code in python...
from math import *
x = int(input("Enter a number: "))
y = int(input("Enter another number: "))
gcd = gcd(x, y)
print("Greatest common divisor of", x, 'and', y, '=', gcd)
lcm = (x*y)/gcd
print("Least common mulitple of", x, 'and', y, '=', lcm)
# Hope this helps you!!
Similar questions