Skip to content

Commit f82d272

Browse files
authored
Create Fibonacci Numbers using boost library
1 parent ec061d9 commit f82d272

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Fibonacci Numbers using boost library

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
#include <bits/stdc++.h>
3+
#include <boost/multiprecision/cpp_int.hpp>
4+
using big_int = boost::multiprecision::cpp_int;
5+
using namespace std;
6+
7+
int fibo(int n)
8+
{
9+
10+
big_int a = 0;
11+
big_int b = 1;
12+
cout <<a<<" "<<b<<" ";
13+
14+
for (int i = 2; i < n; i++)
15+
{
16+
big_int c = a + b;
17+
cout <<c <<" ";
18+
a = b;
19+
b = c;
20+
}
21+
}
22+
23+
24+
int main()
25+
{
26+
int n;
27+
cin>>n;
28+
29+
fibo(n);
30+
31+
return 0;
32+
}

0 commit comments

Comments
 (0)