I was recently asked, in an interview, to describe a method to calculate the factorial of any arbitrarily large number; a method in which we obtain all the digits of the answer.
I searched various places and asked in a few forums. But I would like to know if there is any way to accomplish this without using libraries like GMP.
Thank you.
GNU Multiprecision library is a good one! But since you say using of external libraries are not allowed, only way I believe its possible is by taking an array of int and then multiplying numbers as you do with pen on paper!
Here is the code I wrote some time back..
‘arr’ is just an integer array, and factorial is a simple function that multiplies the given number to the ‘large number’.
Hope this solves your query..