Join 131,814 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,485 people online right now. Registration is fast and FREE... Join Now!
This function does not require a header file.
Besides, it is a code snippet and not a complete application. You will have to call it from main() or any other function to use it.
giotto 2008-02-04 08:59:49
Oh, come on!
It can be done, in one line!
int fibonacci(int number){
return number
giotto 2008-02-04 09:00:20
int fibonacci(int number){
return number
giotto 2008-02-04 09:00:49
:S
nurboja 2008-05-03 03:07:39
int fib(int x)
{
if (x==0) return 0;
else if (x==1) return 1;
else return fib(x-1)+fib(x-2);
}
nurboja 2008-05-03 03:08:04
Fn=0 za n= 0;
Fn=1 za n= 1;
Fn=Fn–1+ Fn–2 za n>=2;