codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
// - Both these code return the same wrong value of 8? // My code I got by myself int FibiRec(int n){ int result = 0; if (n == 0 || n == 1){ return 1; }else{ return FibiRec(n-1) + FibiRec(n-2); } } // Code I got from a number of other sources... long fib(int n) { if (n<2) // stopping cases return 1; else // recursive case return fib(n - 1) + fib(n - 2); } // What am I doing wrong?
Private
[
?
]
Run code
Submit