what's the problem pls help me
in bv mathematic fuction if i wan to use factorial so what is the keyword for factorial???
i use "prev = fact(n) / (fact(n - r))" , why i does not work???
instead of using "fact" what shold i use...
thank you for those who really can help me answer this...
thanks alot in advance 1st... :)
Re: what's the problem pls help me
You can use this function.
VB Code:
Public Function Factorial(intNbr As Integer) As Long
Dim counter As Integer
Dim strAnswer As String
counter = intNbr
Factorial = counter
Do While counter > 1
counter = counter - 1
Factorial = Factorial * counter
Loop
End Function
Re: what's the problem pls help me
or this one if you like recursive code better :)
VB Code:
Public Function Factoral(ByVal nNum As Integer) As Long
If nNum = 1 Or nNum = 0 Then
Factorial = 1
Else
Factorial = nNum * Factorial(nNum - 1)
End If
End Function