Write the program for fibonacci in c++?
Answer Posted / irushad abdulrahman
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a=-1, b=1, c, x;
cout << "Enter a number to find FIBONACCI less than
that:";
cin >>x;
do
{
c=a+b;
cout << c << "\t";
a=b;
b=c;
}
while (c<=(x-c));
cout <<"\n";
system ("pause");
return 0;
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Tell me an example where stacks are useful?
Is c++ vector dynamic?
How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?
Explain the use of vtable.
What is doubly linked list in c++?
When do we run a shell in the unix system? How will you tell which shell you are running?
Is nan a c++?
What does the linker do?
What is pointer in c++ with example?
What are the rules about using an underscore in a c++ identifier?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
How new/delete differs from malloc()/free?
What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor
What is a manipulator in c++?
What are smart pointers?