Write the program for fibonacci in c++?
Answer Posted / dudelzy
Simplest one:
#include <iostream>
using namespace std;
int main()
{
int x, a = 0, b = 1, i, z;
cout << "Lets Start!" << endl;
cout << "No. of elements in the series = ";
cin >> x;
cout << "Series: " << endl;
for(i = 0; i < x; i++){
z = a + b;
a = b;
b = z;
cout << z << endl;
}
return 0;
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is rvalue?
What are static type checking?
What is a memory leak c++?
Give 10 points of differences between C & C++.
What is setiosflags c++?
What does extern mean in a function declaration in c++?
What is anonymous object in c++?
Can you sort a set c++?
How does c++ sort work?
Do you need a main function in c++?
Difference between a copy constructor and an assignment operator.
What are single and multiple inheritances in c++?
What does new do in c++?
What is the function to call to turn an ascii string into a long?
What is the benefit of learning c++?