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
Mention the storage classes in c++.
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
What is the size of a vector?
What is c++ try block?
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()
What does floor mean in c++?
Describe public access specifiers?
What is c++ stringstream?
Can member functions be private?
What is a multiset c++?
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
why is iostream::eof inside a loop condition considered wrong?
What is the role of copy constructor in copying of thrown objects?
Explain the uses oof nested class?
What is an iterator?