We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a79ac1 commit dceab34Copy full SHA for dceab34
Maths/Fibonacci/C++/Fibonacci.cpp
@@ -0,0 +1,27 @@
1
+#include <iostream>
2
+
3
+using namespace std;
4
5
+void fibonacci(int number)
6
+{
7
+ int first = 0, second = 1, next;
8
9
+ for (int i = 0; i < number; i++)
10
+ {
11
+ cout << "\n" << first;
12
+ next = first + second;
13
+ first = second;
14
+ second = next;
15
+ }
16
+}
17
18
+int main()
19
20
+ int number;
21
22
+ cout << "Enter number of terms for Series: ";
23
+ cin >> number;
24
25
+ cout << "Fibonacci Series are: \n";
26
+ fibonacci(number);
27
0 commit comments