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 is meant by entry controlled loop? What all C++ loops are exit controlled?
What happens when you make call 'delete this;'?
What is scope in c++ with example?
How do you compile the source code with your compiler?
What is set in c++?
Is c++ a high level language?
Differentiate between a template class and class template in c++?
If you don’t declare a return value, what type of return value is assumed?
What is difference between c++ 11 and c++ 14?
Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
How do I use turbo c++?
What is endl?
What is c++ w3school?
What is pointer in c++ with example?