Write the program for fibonacci in c++?
Answer Posted / ria
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr ();
int n,f1,f2,f3,i;
cout<<"/n input the no.of terms";
cin>>n;
f1=-1;
f2=1;
cout<<"/n the fibonacci series is ";
for(i=1,i<=n,i++)
{
f3=f1+f2;
cout<<"/n"<<f3;
f1=f2;
f2=f3;
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is c++ w3school?
What are the advantages of using pointers in a program?
Does c++ vector allocate memory?
What is binary object model?
Can we define a constructor as virtual in c++?
What does h mean in maths?
Should I learn c or c++ first?
What is enum class in c++?
How can you quickly find the number of elements stored in a static array?
Explain all the C++ concepts using examples.
Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers
Why would you use pointers in c++?
What is static function? Explain with an example
What is difference between malloc()/free() and new/delete?
Why isn't sizeof for a struct equal to the sum of sizeof of each member?