Write the program for fibonacci in c++?
Answer Posted / joy
#include<iostream.h>
#include<conio.h>
voidmain()
{
clrscr();
int f1=0,f2=1,f3,n,i;
cout<<"Enter the number of terms...";
cin>>n;
cout<<"Fibonacci Series\n";
cout<<f1<<'\n'<<f2<<'\n';
for(i=3;i<=n;i++)
{
f3=f1+f2;
cout<<f3<<'\n';
f1=f2;
f2=f3;
}
getch();
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Is it possible to provide default values while overloading a binary operator?
What is the full name of logo?
What is the best c++ compiler for windows 10?
Can I learn c++ without c?
Explain how an exception handler is defined and invoked in a Program.
Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers
Why is c++ awesome?
How does com provide language transparency?
What is the difference between prefix and postfix versions of operator++()?
Differentiate between an external iterator and an internal iterator?
What is c++ virtual inheritance?
How do you invoke a base member function from a derived class in which you have not overridden that function?
How delete [] is different from delete?
How we can differentiate between a pre and post increment operators during overloading?
What happens if a pointer is deleted twice?