Skip to content Skip to sidebar Skip to footer

To Find The Lcm Of Two Numbers

I was given the task to compute lcm of any two numbers.I have coded in python.The problem is when i compiled it under python2.7, i got a result which is different from , when i co

Solution 1:

In Python 2 the division operator / will perform integer division, and not float division, when dealing with two integers. You can force the Python 3 behavior in Python 2 by importing division from __future__

>>> from __future__ import division
>>> 2/3
1.5

Post a Comment for "To Find The Lcm Of Two Numbers"