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
What is a map in c++?
describe private access specifiers?
How would you call C functions from C++ and vice versa?
What is the difference between function overloading and operator overloading?
What is the most useful programming language?
When should I use unitbuf flag?
What are function prototypes?
Evaulate: 22%5 a) 2 b) 4 c) 0
What are shallow and deep copy?
Ask to write virtual base class code?
Difference between delete and free.
Show the application of a dynamic array with the help of an example.
When does the c++ compiler create temporary variables?
Why was c++ created?
How would you use qsort() function to sort an array of structures?