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
Describe private, protected and public – the differences and give examples.
What is new in c++?
What is the default access level?
How do you define/declare constants in c++?
Explain the use of vtable.
Explain how overloading takes place in c++?
what is COPY CONSTRUCTOR and what is it used for?
What is meant by entry controlled loop?
Which is better c++ or java?
Why are pointers not used in c++?
Do you know the problem with overriding functions?
How can I learn dev c++ programming?
Can I run c program in turbo c++?
What is the use of "new" operator?
Why should you learn c++?