Write the program for fibonacci in c++?
Answer Posted / ria
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr ();
int n,f1,f2,f3,i;
cout<<"/n input the no.of terms";
cin>>n;
f1=-1;
f2=1;
cout<<"/n the fibonacci series is ";
for(i=1,i<=n,i++)
{
f3=f1+f2;
cout<<"/n"<<f3;
f1=f2;
f2=f3;
}
getch();
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are default parameters? How are they evaluated in c++ function?
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
what is data abstraction in C++?
What is function overloading in C++?
What is the most useful programming language?
What is malloc in c++?
What does return 0 do in c++?
Are there interfaces in c++?
What is the use of setprecision in c++?
What is private inheritance?
What is input operator in c++?
What is the difference between the functions rand(), random(), srand() and randomize()?
What are static member functions?
How long it will take to learn c++?
How is c++ different from java?