+ 1
Is there a method to find large factorials having values larger than long long int also?
Is it possible to reach that limits using C language. Example: Is it possible to calculate 100! using C
8 ответов
+ 4
You can use a logarithmic approximation or an arbitrary precision integer arithmetic
https://stackoverflow.com/questions/1384160/calculating-factorial-of-large-numbers-in-c
You can even handle it by yourself by storing big numbers splitted along an array rather than stored in a single variable. But I guess that's not easy.
+ 2
If you need to face a really big number you might need to use a third party library or implement one yourself. unsigned long long can save up to 2^64-1, which is about 17 digits. Definitely not enough and not possible to save the number.
+ 2
You can use gcc specific __uint128_t type which would allow you to calculate up to 34!
Above that you need multiple precision arithmetics - either implementing your own, or using an existing library (for example gmp)
+ 1
This post might interest you:
https://www.sololearn.com/post/88511/?ref=app
+ 1
You can use "School's multiplication" method, I forgot the name exactly but you can try to look it up, I'm pretty sure you have a google search bar, I remember I've seen one on gfg.
+ 1
LastSecond959 it is known as "russian peasant multiplication".
0
It will be error