The Code is as follows:
Copy codeThe Code is as follows: # include <stdio. h>
# Include <stdlib. h>
# Define N 10 // calculate the factorial of N
Int main ()
{// Array 1-digit 1!
Int ary [N] = {1, 1 };
Int I, j;
For (I = 2; I <= N; I ++)
{
// Factorial of each lower mark. The 0th-bit subscript is the number of digits, so it starts from 1st bits.
For (j = 1; j <= ary [0]; j ++)
{
Ary [j] = ary [j] * I;
}
// Handle the carry problem by one second
For (j = 1; j <= ary [0]; j ++)
{
If (ary [j]> = 10000)
{
// Carry
Ary [j + 1] = ary [j + 1] + ary [j]/10000;
// After carrying, only the remainder is left.
Ary [j] = ary [j] % 10000;
}
}
// If there is an increment, the number of digits is + 1
// Here j is already a bit larger than 1
If (ary [j]> = 1)
{
Ary [0] ++;
}
}
// Inverted output
For (j = ary [0]; j> 0; j --)
{
Printf ("% d", ary [j]);
}
Printf ("\ r \ n ");
Return 0;
}