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

python find lcm

def lcm(a, b):
        i = 1
        if a > b:
                c = a
                d = b
        else:
                c = b
                d = a
        while True:
                if ((c * i) / d).is_integer():
                        return c * i
                i += 1;
Comment

PREVIOUS NEXT
Code Example
Python :: load image metadata with pil 
Python :: python bubble sort 
Python :: python text reverse 
Python :: how to take first digit of number python 
Python :: read clipboard python 
Python :: run python script on android 
Python :: how to clear the list in python 
Python :: Setting up Colab for Kaggle Downloads 
Python :: socket get hostname of connection python 
Python :: all() python 
Python :: difference between method and function in pyhon 
Python :: post request socket python 
Python :: python try except finally 
Python :: doomsday fuel foobar 
Python :: python extract string 
Python :: python two string equal 
Python :: kpss test python 
Python :: python index max list 
Python :: What is the use of f in python? 
Python :: static files in django 
Python :: how to type using selenium python 
Python :: how to install arcade in python 
Python :: Set symmetric Using Python Set symmetric_difference() Method 
Python :: size pandas dataframe 
Python :: get return value from transaction in brownie 
Python :: square a number in python 
Python :: django start app 
Python :: get array dimension numpy 
Python :: python error handling 
Python :: break while loop python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =