Public Class Form6
Dim a, b, c, e As Integer
Function combinatorio(ByVal b As Integer, ByVal e As Integer) As Integer
If e = 0 Or e = b Then
Return 1
Else
If e = 1 Then
Return b
Else
Return combinatorio(b - 1, e) + combinatorio(b - 1, e - 1)
End If
End If
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = TextBox1.Text
c = TextBox2.Text
Dim d As Integer = combinatorio(a, c)
Label2.Text = d
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form7.Show()
End Sub
End Class

No hay comentarios:
Publicar un comentario