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
Which one between if-else and switch is more efficient?
Which is the best c++ compiler for beginners?
How static variables and local variablesare similar and dissimilar?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
What is virtual destructor ans explain its use?
How do I exit turbo c++?
What are the advantage of using register variables?
Explain the difference between static and dynamic binding of functions?
Are vectors faster than arrays?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
What is the difference between equal to (==) and assignment operator (=)?
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
Which operator cannot be overloaded c++?
What is bubble sort c++?