23 lines
592 B
Plaintext
23 lines
592 B
Plaintext
<%
|
|
Function Fibonacci(ByVal intNumber)
|
|
If (intNumber = 0 Or intNumber = 1) Then
|
|
Fibonacci = intNumber
|
|
Else
|
|
Fibonacci = Fibonacci(intNumber - 1) + Fibonacci(intNumber - 2)
|
|
End If
|
|
End Function
|
|
%>
|
|
|
|
And here is how we test the function
|
|
|
|
<%
|
|
'variables to store our numbers
|
|
Dim fib1 , fib2
|
|
'a couple of values
|
|
fib1 = 22
|
|
fib2 = 3
|
|
'display fibonacci value of values e.g Fibonacci(3)
|
|
Response.Write ("The Fibonacci value of " & fib1 & " is " & Fibonacci(fib1) & "<br>")
|
|
Response.Write ("The Fibonacci value of " & fib2 & " is " & Fibonacci(fib2) & "<br>")
|
|
%>
|