The following link is the Java implementation, the idea is called Clear point
http://blog.51cto.com/6631065/2044441
#include <stdio.h>void Print_Factorial ( const int N ); Int main ( ) {int n;scanf ("%d", &n); Print_factorial (N); return 0;} Void print_factorial (const int n) {#define &NBSP;MAX&NBSP;5000INT&NBSP;A[MAX]=&NBSP;{0}, tmpa[max]= {0},b[4]= {0};int k,i,flag,j,temp,bit,l;int f1=0,f2=0,f3=0;/* If less than 0 is greater than 1000 directly returns the input error */if (n <0 | | n >1000) {printf ("invalid input\n"); return;} /* equals 0 output 1*/else if (n == 0) {printf ("%d\n", 1); return ;} /* greater than 0 less than 1000*/else {/* assigns the first bit of array A to 1 and the remaining assignment to zero */a[0] =1;for (i=1; i<=n; i++) {b[0]=b[1]=b [2]=b[3]=0;flag =i;/* the number of N to be decomposed into array b */k=0;while (flag > 0 && k<4) {b[k] = flag %10;flag = flag /10;k++;} Temp =0;bit =0;for (j=0; j<4; j++) {/* uses the value stored by the Tmpa to multiply the B array, and the result is saved to the A array */for (l=0; l <max; l++) &NBsp {temp = a[l] *b[j];tmpa[l+j]+= temp;}} for (k=0; k<max-1; k++) {if (tmpa[k]>=10) {temp = tmpa[k];tmpa[k] = &NBSP;TMPA[K]&NBSP;%10;TMPA[K+1]&NBSP;=&NBSP;TMPA[K+1]+TEMP/10;}} for (k=0; k<max; k++) {a[k] =tmpa[k];tmpa[k] =0;}}} printf ("\ n"); F3=0;for (k=max-1; k>=0; k--) {if (a[k] >0) f3=1;if (f3>0) printf (" %d ", a[k]);}}
The following link is the Java implementation, the idea is called Clear point
http://blog.51cto.com/6631065/2044441
Find the factorial of a larger integer n, because n is larger, the factorial of n is outside the normal type of representation, and can be manipulated using arrays (C implementation)