Posted By

Scooter on 07/12/08


Tagged

math


Versions (?)

Fibonacci numbers


 / Published in: ASP
 

URL: http://reusablecode.blogspot.com/2008/07/fibonacci-numbers.html

  1. <%
  2. ' Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved.
  3. '
  4. ' This work is licensed under the Creative Commons Attribution License. To view
  5. ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or
  6. ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
  7. ' 94305, USA.
  8.  
  9. ' Get Fibonacci number
  10. function fib(x)
  11. dim fibArray()
  12. redim fibArray(x)
  13.  
  14. fibArray(0) = 0
  15. fibArray(1) = 1
  16.  
  17. for i = 2 to x
  18. fibArray(i) = fibArray(i - 1) + fibArray(i - 2)
  19. next
  20.  
  21. fib = fibArray(x)
  22. end function
  23. %>

Report this snippet  

You need to login to post a comment.