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
Are strings immutable in c++?
Can char be a number c++?
How do I exit turbo c++?
Explain what are accessor methods?
What is class in c++ with example?
How new/delete differs from malloc()/free?
What are 2 ways of exporting a function from a dll?
Explain terminate() function?
Is c++ slower than c?
Difference between strdup and strcpy?
What is enum c++?
What is format for defining a structure?
What methods can be overridden in java?
Do you know the problem with overriding functions?
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?