编写一个程序求n的阶乘 如何用c 编写一程序计算100的阶乘?

如何用c 编写一程序计算100的阶乘?阶乘算法(0---10000)#include#include#includeconst int N=1000 int compute(unsigned int

如何用c 编写一程序计算100的阶乘?

阶乘算法(0---10000)

#include

#include

#include

const int N=1000

int compute(unsigned int *s,int n)//s用来存储一次的计算结果,n为本次计算的乘数,函数返回结果中有效数据的节数

{

unsigned long p //暂时存放一节的结果

unsigned long more=0//一次乘法的进位

int i //循环变量

static int m=1//存放结果中的节数,三位一节

static int q=0//存放结果中最后为零的节数

//计算本次的结果

for(i=qi