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
what Is DCS ? what i will get benefit when i did?
What is the standard template library (stl)?
Eplain extern keyword?
Why cout is used in c++?
what are the iterator and generic algorithms.
Is c++ a pure oop language?
Explain what you mean by a pointer.
What is ios :: in in c++?
What is the main purpose of overloading operators?
When you overload member functions, in what ways must they differ?
Will rust take over c++?
Why do we learn c++?
Is multimap sorted c++?
What is constructor and destructor in c++?
What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?