Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

lcm math python library

from math import gcd
def lcm(a,b):
  return a*b/(gcd(a,b))
print(lcm(12,70))
//output: 420
Comment

lcm in python

def lcm(x, y):
   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 =int (input("enter the first nummber: "))
num2 = int (input("enter the second number: "))

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

PREVIOUS NEXT
Code Example
Python :: no python 3.10 installation was detected 
Python :: how to append to text file with new line by line in python 
Python :: pandas count specific value in column 
Python :: python combine side by side dataframes 
Python :: how to calculate running time in python 
Python :: knn sklearn 
Python :: python tkinter filedialog folder 
Python :: how to get the contents of a txt file in python 
Python :: find all text in site python 
Python :: create virtualenv in pythonanywhere 
Python :: ImportError: cannot import name ‘json’ from itsdangerous 
Python :: pd.to_datetime python 
Python :: python str replace specifiek index 
Python :: python datetime round to nearest hour 
Python :: list to json python 
Python :: pd.set_option show all rows 
Python :: get current time in python with strftime 
Python :: set window size tkinter 
Python :: tan for python 
Python :: how to make a discord bot delete messages python 
Python :: python requests.get timeout 
Python :: column string to datetime python 
Python :: telegram markdown syntax 
Python :: python alfabet 
Python :: python get dir 
Python :: add horizontal line plotly 
Python :: python plot lines with dots 
Python :: yesterday in python 
Python :: image delete in django from the folder 
Python :: python f string thousand separator 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =