Factorial of Large Number Using boost multiprecision Library

To find the factorial of a large number, we can use the boost library. This library provides high precision numbers. Using boost multiprecision library we can get more precision than 64 bits.

Example

#include 
#include 
using boost::multiprecision::cpp_int;
using namespace std;
cpp_int Large_Fact(int number) {
   cpp_int fact = 1;
   for (int i = 1; i > fact >> endl;
}

Output

9332621544394415268169923885626670049071596826438162146859296389521759999322
9915608941463976156518286253697920827223758251185210916864000000000000000000
000000
Updated on: 2019-07-30T22:30:26+05:30

217 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements