50位的n!计算,如何储存大数,使后面的零变少
#include<stdio.h>double Fact(unsigned int n);
int main()
{
int m;
for (m=1; m<=40; m++)
{
printf("%d! = %.0f\n", m, Fact(m));
}
return 0;
}
double Fact(unsigned int n)
{
unsigned int i;
double result = 1;
for (i=2; i<=n; i++)
result *= i;
return result;
}