Find the factorial of 100 in C++?

the only option is to use string and basic mathematical operations as no data type can store that huge number .

use an array of integer and implement in such a way that this array can store huge data

I am giving the code for implementing this type of array

The Formula of fact(n) is n*(n-1)*(n-2)*â€¦3*2*1

means you have to multiply and this will give you a huge number that you cannot store in any data type.

```
int a[170];
a[0]=1;
m=1;
temp = 0;
for(i=1;i<=n;i++) // to multiply n number
{
for(j=0;j<m;j++)
{
x = a[j]*i+temp;
a[j]=x%10;
temp = x/10;
}
while(temp!=0)
{
a[m]=temp%10;
temp = temp/10;
m++;
}
}
```

Now print the array element from m-1 to 0 index;

You can also follow my code for [this][1] problem

My code is :

[http://www.codechef.com/viewsolution/1567814][2]

If you still have any doubt in this method you may ask me.

Happy Coding!!!

[1]: http://www.codechef.com/problems/FCTRL2/

[2]: http://www.codechef.com/viewsolution/1567814

Have you tried http://www.codechef.com/problems/FCTRL2? If youâ€™re still having difficulty with understanding the approaches outlined in the previous answers, go to the tutorial of the aforementioned problem, where a detailed and very well written explanation of roughly the same approach can be found.

learn python

C++ doesnâ€™t data types to store such large values as 100! will have approx 150 digits, where as long long int support only 4*10^18. So, you need to handle big integers with the help of arraysâ€¦U can take help from this link on how to handle large numbersâ€¦! â€śhttp://e-maxx.ru/algo/big_integerâ€ťâ€¦

You can use c++ boost library for multiplication of very large numbersâ€¦ to find 100! use boost library for large multiplicationâ€¦

```
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using namespace std;
mp::cpp_int fact(mp::cpp_int a)
{
if(a==1)
return 1;
if(a==0)
return 0;
return a * fact(a-1);
}
int main()
{
int t;
cin>>t;
while(t--)
{
mp::cpp_int a;
cin>>a;
cout<<fact(a)<<endl;
}
return 0;
}
```

actually this is solution to FCTRL2 problemâ€¦

would u plz code itâ€¦

@alokamaster : i would rather advise you to try this as an assignment. you will definitely learn the art of dealing with operations of large numbersâ€¦

secondly, you will get introduced to the concept of polynomial multiplications and how to use Fourier transform to do the same!!