Current location - Loan Platform Complete Network - Big data management - Find the factorial of n in c. Note that n may be very large and the factorial may exceed the integer range.
Find the factorial of n in c. Note that n may be very large and the factorial may exceed the integer range.
Demanding processing time? Try preprocessing, record the factorial result in a string array (a two-bit char type array is fine),

char str[200][100] ;//Maximum calculation 200! The number is up to 100 bits

In str[0][]=1;

str[1][]=1;

str[2] []=2;

str[3][]=str[2][]*3;

str[4][]=str[3][]*4;..... This way the calculation will be fast;

Then all you have to do is write your own big data multiplication, (String A and String B simulate multiplying two numbers, if you can't write it you search online for big data multiplication C)