Numpy LCM and HCF

Let us see how to find the LCM and HCF of two numbers in Numpy. The numpy.lcm() is used to find the LCM, whereas numpy.gcd() method returns the GCD in Python.

LCM of two numbers in Numpy

LCM is the least common multiple of two integers. To find the LCM (Least Common Multiple) of two numbers, NumPy has a method lcm().

Let us see an example:

Output

HCF/ GCD of two numbers in Numpy

The GCD of two numbers is the greatest number that divides both the integers. To find the HCF/ GCD of two numbers, Numpy has a method gcd().

Let us see an example:

Output

If you liked the tutorial, spread the word and share the link and our website Studyopedia with others:


For Videos, Join Our YouTube Channel: Join Now


Read More:

Numpy Logs
NumPy Cheat Sheet
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading