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 the history of c++?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
Explain the concept of copy constructor?
Is c better than c++?
Explain dangling pointer.
What are the two types of polymorphism?
What is class definition in c++ ?
Explain the concept of memory leak?
Evaluate !(1&&1||1&&0) a) Error b) False c) True
What is lambda in c++?
Difference between inline functions and macros?
What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required
What is auto used for in c++?
What are manipulators in c++ with example?
What is the full form of india?