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
Does dev c++ support c++ 11?
what are Access specifiers in C++ class? What are the types?
Why are pointers used?
What is c++ vb?
what are the iterator and generic algorithms.
Do you need a main function in c++?
Tell me can a pure virtual function have an implementation?
Why do we use classes in programming?
Difference between a homogeneous and a heterogeneous container
What are the implicit member functions of class?
Is c++ platform dependent?
What is the arrow operator in c++?
What is the difference between structure and class?
Out of fgets() and gets() which function is safe to use and why?
Why is main function important?