Write the program for fibonacci in c++?
Answer Posted / nitish kumar nirala
#include<iostream.h>
#include<conio.h>
int fibo(int);
void main()
{
int n,fibbon;
cin>>n;//input number to find fabbonic series
fibbo=fibo(n);
cout<<fibbo<<"
";
getch();
}
int fibo(n)
{
if(n==0)
{
return 0;
}
elseif(n==1)
{
return 1;
}
else
{
return(fibo(n-1)+fibo(n-2));
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How can you link a c program with a c function?
What is the most powerful coding language?
Which function cannot be overloaded c++?
Explain the use of virtual destructor?
What is string in c++ programming?
What is binary search in c++?
Is std :: string immutable?
What is a float in c++?
When does a 'this' pointer get created?
Explain static and dynamic memory allocation with an example each.
Define a nested class. Explain how it can be useful.
Is eclipse good for c++?
What is pointer to array in c++?
How many types of modularization are there in c++?
What flag means?