Funkce:
' Pou₧itφ
Euclidova algoritmu
' Pokud je jeden z paramtr∙ 0, vygeneruje chybu "Division by Zero"
Function GCD(ByVal n1 As Long, ByVal n2 As Long) As Long
Dim tmp As Long
Do
' P°ehozenφ hodnot, aby n1 >= n2
If n1 < n2 Then
tmp = n1
n1 = n2
n2 = tmp
End If
n1 = n1 Mod n2
Loop While n1
GCD = n2
End Function
|