diff --git a/Algebra-and-Numerical-Methods/LongIntegerFactorial.cpp b/Algebra-and-Numerical-Methods/LongIntegerFactorial.cpp new file mode 100644 index 0000000..441d1ea --- /dev/null +++ b/Algebra-and-Numerical-Methods/LongIntegerFactorial.cpp @@ -0,0 +1,53 @@ + +#include +#define int long long +#define vi vector +using namespace std; + +//This algorithm calculates the Factorial of very long Integers.. + +void multiply(int num, int &posi, vector &v) +{ + // to multiply every index element by num and adding remaining carry to the next index.... + int carry=0; + for(int i=0; i>n; + vector v(1000); + v[0]=1; + + + int posi=1; + for(int i=2; i<=n; i++) + multiply(i, posi, v); + + //posi is the position till where an valid element is present at index....i.e the last element from starting of array... + for(int i=posi-1; i>=0; i--) + cout<