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
Explain how an exception handler is defined and invoked in a Program.
Differentiate between realloc() and free().
What are the two main components of c++?
What is the difference between cin.read() and cin.getline()?
How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?
Why do we need runtime polymorphism in c++?
What is the use of object in c++?
How did c++ start?
What is problem with overriding functions?
What are references in c++? What is a local reference?
Define pure virtual function?
what you know about c++?
What is recursion?
What are namespaces in c++?
What are the various compound assignment operators in c++?