Imports System
Public Class Program
Public Shared Function getLMC(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Integer
Dim lmc As Integer = Math.Max(Math.Max(a, b), c)
While True
If lmc Mod a = 0 AndAlso lmc Mod b = 0 AndAlso lmc Mod c = 0 Then
Return lmc
End If
lmc += 1
End While
return -1
End Function
Public Shared Sub Main()
Dim a As Integer = 12, b As Integer = 15, c As Integer = 40
Console.WriteLine("The LCM (Least Common Multiple) is: {0}", getLMC(a, b, c))
End Sub
End Class
' run:
'
' The LCM (Least Common Multiple) is: 120
'