Skip to content

Commit 08f33d6

Browse files
authored
Merge pull request #367 from NidhiChaurasia/patch-11
Fibonacci_SeriesUptoN.cpp
2 parents b984600 + b487a3f commit 08f33d6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
#include<iostream>
3+
using namespace std;
4+
5+
int main()
6+
{
7+
8+
int limit, first=0, second=1, next, num;
9+
cout <<“Enter the limit of Fibonacci series”<<endl;
10+
11+
cin >> num;
12+
cout << “First “<<num<<” terms of Fibonacci series are :- “<<endl;
13+
14+
for(int p=0;p<num;p++)
15+
{
16+
if (p <= 1)
17+
next = p;
18+
else
19+
{
20+
next = first + second;
21+
first = second;
22+
second = next;
23+
}
24+
cout<<next<<” “;
25+
}
26+
return 0;
27+
}

0 commit comments

Comments
 (0)