#include <stdio.h> #include <stdlib.h> #include <string.h> #define MaxSize 1000000 char *BigNumFactorial(int InputOrderMultiplier) { int *TempResult = malloc(MaxSize*sizeof(int)); int TempResultEnd; memset(TempResult,0,MaxSize*sizeof(int)); TempResult[0] = 1; char *Result = malloc(MaxSize*sizeof(char)); memset(Result,0,MaxSize*sizeof(char)); int ResultEnd = 0; int Carry = 0,Digit = 1; int TripNum,TripDigit; int Temp; for(TripNum = 2;TripNum <= InputOrderMultiplier;TripNum ++) { Carry = 0; for(TripDigit = 0;TripDigit < Digit;TripDigit ++) { //multiply every TR's TD by TN Temp = TempResult[TripDigit]*TripNum + Carry; TempResult[TripDigit] = Temp % 10; Carry = Temp / 10; } while(Carry) { TempResult[Digit++] = Carry % 10; Carry /= 10; } } for(TempResultEnd = Digit-1;TempResultEnd >= 0;TempResultEnd --) { Result[ResultEnd++] = TempResult[TempResultEnd] + '0'; } Result[ResultEnd] = '