|
Coffee Lounge Talk amongst other community members. |
|
LinkBack | Topic Tools | Rate Topic |
|
|||
If any c programmers are curious.. (notice the recursion.. ie fib() calling itself)
long fib(unsigned long n) { if (n <= 1) { return n; } else { return fib(n-1)+fib(n-2); } } whoops forgot to explain how it works. If you actually go though trace of the above function you'll get: fib(0) => 1 fib(1) => 1 fib(2) => 2 fib(3) => 3 fib(4) => 5 fib(5) => 8 fib(6) => fib(5) + fib(4) = 13 // we've already calculated the 4th and 5th fib and so on... basically fib(n) gives you the nth fibannaci number in the sequence. You can plug in any number for n Last edited by Junglist; Dec 07, 06 at 08:21 PM. Reason: added explaination |
|
||||
so anyways, back on track... super fucking lame of the owner to pull that shit on steve. sketchy bar owners suck, later that same night he actually kicked someone i know while she was trying to get back inside to get her bags
Last edited by dabbler; Dec 07, 06 at 08:04 PM. |
|
|||
Quote:
Classy. |