Program to find LCM of 2 numbers without using GCD | C # program to find LCM of 2 numbers without using GCD ; Function to return LCM of two numbers ; Driver Code
using System ; class GfG { public static int findLCM ( int a , int b ) { int lar = Math . Max ( a , b ) ; int small = Math . Min ( a , b ) ; for ( int i = lar ; ; i += lar ) { if ( i % small == 0 ) return i ; } } public static void Main ( ) { int a = 5 , b = 7 ; Console . WriteLine ( " LCM ▁ of ▁ " + a + " ▁ and ▁ " + b + " ▁ is ▁ " + findLCM ( a , b ) ) ; } }