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 the advantage of c++ over c?
What is dev c++ used for?
What is wrapper class in c++?
What are the advantages of using pointers in a program?
To what does “event-driven” refer?
what are the iterator and generic algorithms.
What are the four main data types?
Do we have to use initialization list in spite of the assignment in constructors?
Is ca high or low level language?
What is meaning of in c++?
What is a manipulative person?
Can you explicitly call a destructor on a local variable?
what are function pointers?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass
Is swift better than c++?