broadcast28
03-10-2004, 04:07 AM
Hi
I need to Create a Visual Basic application that takes in a number of people and displays the number of handshakes exchanged.
The recursive formula is
HandShake(N) = (N-1) + HandShake(N-1)
And this is the function.
Function HandShake(n As Integer) As Integer
If n = 1 Then
' Number of handshakes between 1 person
HandShake = 0
Else
HandShake = (n - 1) + HandShake(n - 1)
End If
End Function
However I am unsure on how to create a form to call this function.
any suggestions would be appreciated
:eek:
I need to Create a Visual Basic application that takes in a number of people and displays the number of handshakes exchanged.
The recursive formula is
HandShake(N) = (N-1) + HandShake(N-1)
And this is the function.
Function HandShake(n As Integer) As Integer
If n = 1 Then
' Number of handshakes between 1 person
HandShake = 0
Else
HandShake = (n - 1) + HandShake(n - 1)
End If
End Function
However I am unsure on how to create a form to call this function.
any suggestions would be appreciated
:eek: