Dovesse servirvi...
Eccolo:
''' -----------------------------------------------------------------------------
''' <summary>
''' Calcola il minimo comune multiplo
''' </summary>
''' <param name="num">Interi tra cui calcolare il mcm</param>
''' <returns></returns>
''' <remarks>
''' </remarks>
''' <history>
''' [michele] 08/02/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overloads Shared Function mcm(ByVal ParamArray num() As Int32) As Int32
If num.Length = 0 Then
Return 0
ElseIf num.Length = 1 Then
Return num(1)
End If
mcm = num(0)
For N As Int32 = 1 To num.GetUpperBound(0)
mcm = mcm(mcm, num(N))
Next N
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' Calcola il minimo comune multiplo
''' </summary>
''' <param name="a">Primo intero</param>
''' <param name="b">Secondo intero</param>
''' <returns></returns>
''' <remarks>
''' </remarks>
''' <history>
''' [michele] 08/02/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overloads Shared Function mcm(ByVal a As Int32, ByVal b As Int32) As Int32
Dim c As Long = a * b
'Dim r As Long
Do
mcm = a Mod b
a = b
b = mcm
Loop While mcm <> 0
Return Convert.ToInt32(c \
a)
End Function
powered by IMHO 1.3