Código:
ublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As Double Dim b As Double Dim c As Double Dim resto As Double a = Val(TextBox1.Text) b = Val(TextBox2.Text) If b > a Then c = a a = b b = c End If If a = 0 Or b = 0 Then MsgBox("Debes introducir dos enteros positivos") If (a Mod b) <> 0 Then Do While a >= b And b <> 0 resto = (a Mod b) a = b b = resto Loop Label1.Text = "El máximo común divisor es " & a Else : Label1.Text = "El máximo común divisor es " & b End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" Label1.Text = "" End Sub End Class