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
What is a set in c++?
Which operations are permitted on pointers?
What are the five basic elements of a c++ program?
What is #include c++?
Is c++ free?
How does code-bloating occur in c++?
Write some differences between an external iterator and an internal iterator?
why is iostream::eof inside a loop condition considered wrong?
Difference between overloaded functions and overridden functions
What does scope resolution operator do?
Explain about Virtual Function in C++?
What header file is needed for exit(); a) stdlib.h b) conio.h c) dos.h
Do you know about latest advancements in C++ ?
What is the best c++ compiler?
What is meant by iomanip in c++?