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 COPY CONSTRUCTOR and what is it used for?
Difference between an inspector and a mutator
What is else if syntax?
When can I use a forward declaration?
What's the hardest coding language?
What is c++ hiding?
Explain polymorphism?
What is endianness?
What is static function? Explain with an example
What is const pointer and const reference?
What is void pointer in c++ with example?
Tell me can a pure virtual function have an implementation?
Write about the use of the virtual destructor?
What is a memory leak c++?
What is endl c++?