"Steve" <kg******@hotmail.com> wrote

I am using Label1 = 15 and Label2 = 18. When I run the procedure I get a

value of 0. I should get 3. I can't figure out what is going wrong.

Compare your code with this:

HTH

LFS

Dim x, y, r As Integer

' get values

x = CInt(Label1.Text)

y = CInt(Label2.Text)

' order large to small

If x < y Then

r = y

y = x

x = r

End If

' find GCD

Do

r = x Mod y

x = y

y = r

Loop Until r = 0

' return GCD

Console.WriteLine(x)