Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Program to Compute LCM

# Python Program to find the L.C.M. of two input number

def compute_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)):
           lcm = greater
           break
       greater += 1

   return lcm

num1 = 54
num2 = 24

print("The L.C.M. is", compute_lcm(num1, num2))
Comment

PREVIOUS NEXT
Code Example
Python :: python disable logging on unittest 
Python :: getenv python 
Python :: socket get hostname of connection python 
Python :: python finally keyword 
Python :: django meta attributes 
Python :: pandas hist normalized 
Python :: automate boring stuff with python 
Python :: django get latest object 
Python :: fibonacci recursive python 
Python :: python isinstance 
Python :: calculate term frequency python 
Python :: python create temp file 
Python :: flask session timeout 
Python :: python @property 
Python :: get file size python 
Python :: one liner if else replacement in python 
Python :: arg parse array argument 
Python :: start process python 
Python :: how to type using selenium python 
Python :: float to int in python 
Python :: str replace pandas 
Python :: python reference parent module 
Python :: How to track hands python opencv/mediapipe 
Python :: python turn positive into negative 
Python :: BURGERS2 codechef solution 
Python :: drop row with duplicate value 
Python :: create dictionary 
Python :: python reduce 
Python :: python qt always on top 
Python :: logging.basicConfig() 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =