We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 40b7655 + e3f1d1d commit 24e2de8Copy full SHA for 24e2de8
1 file changed
Basic/Calculate Nth Fibonacci Number/SolutionByPrabsimar.cpp
@@ -0,0 +1,27 @@
1
+#include <iostream>
2
+using namespace std;
3
+
4
+int main() {
5
+ int n;
6
+ cout<<"Enter a number: ";
7
+ cin>> n;
8
9
+ int a = 0;
10
+ int b = 1;
11
+ int c;
12
13
+ cout<<"\n"<<a;
14
+ cout<<"\n"<<b;
15
16
+ int j=2;
17
+ while(j<n)
18
+ {
19
+ c=a+b;
20
+ a=b;
21
+ b=c;
22
23
+ cout<<"\n"<<c;
24
+ j++;
25
+ }
26
+ return 0;
27
+}
0 commit comments