Advertisements
Advertisements
प्रश्न
Write a Python code to find the L.C.M. of two numbers.
Advertisements
उत्तर
Program:
# Python Program to find the L.C.M. of two input number
defcompute_lcm(x, y):
# choose the greater number
if x > y:
greater = x
else:
greater = y
while (True):
if((greater % x == 0) and (greater % y == 0)):
1cm = greater
break
greater += 1
return 1cm
num1=int(input(//Enter first number=”))
num2=int(input(“Enter second number=”))
print
(“The L.C.M. is”, compute_lcm(num1, num2))
Output:
Enter first number=8
Enter second number=4
The L.C.M. is 8.
APPEARS IN
संबंधित प्रश्न
Which function is called anonymous un-named function?
While defining a function which of the following symbol is used.
Pick the correct one to execute the given statement successfully.
if ______ : print(x, " is a leap year")
What is a function?
Write the different types of functions.
How to set the limit for recursive function? Give an example.
Differentiate ceil() and floor() function?
Explain the different types of functions with an example.
Explain the following built-in function.
round()
Explain the following built-in function.
type()
