Program to find LCM of 2 numbers without using GCD | Python 3 program to find LCM of 2 numbers without using GCD ; Function to return LCM of two numbers ; Driver Code
import sys NEW_LINE def findLCM ( a , b ) : NEW_LINE INDENT lar = max ( a , b ) NEW_LINE small = min ( a , b ) NEW_LINE i = lar NEW_LINE while ( 1 ) : NEW_LINE INDENT if ( i % small == 0 ) : NEW_LINE INDENT return i NEW_LINE DEDENT i += lar NEW_LINE DEDENT DEDENT a = 5 NEW_LINE b = 7 NEW_LINE print ( " LCM ▁ of ▁ " , a , " ▁ and ▁ " , b , " ▁ is ▁ " , findLCM ( a , b ) , sep = " " ) NEW_LINE