Write the program for fibonacci in c++?
Answer Posted / darren chang
int fib(int input)
{
if(input==0)
return 0;
if((input==1)||(input==2))
return 1;
else
return fib(input-1)+fib(input-2);
}
| Is This Answer Correct ? | 10 Yes | 31 No |
Post New Answer View All Answers
What are inline functions? What is the syntax for defining an inline function?
What is the best book for c++ beginners?
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
Define what is constructor?
What is the type of 'this' pointer?
Is c better than c++?
Search for: what is pair in c++?
What is a dynamic binding in c++?
Explain the pure virtual functions?
What is the most powerful coding language?
What is the difference between interpreters and compilers?
What is exception handling? Does c++ support exception handling?
What is a block in c++?