求助!谢谢高人指点。。。。。。
/*求助,我想用这个小程序求300以内的阶乘。值是可以算出来的,但是前面不知道怎么去掉多余了很多的“000000”谢谢高人指点,本人初学C,谢谢各位啦*/#include <stdio.h>
#include <math.h>
void main()
{
int a[256],b,d;
long m;
int n,i,j,r;
printf("value of n:\n");
scanf("%d",&n);
m=(long)log(n)*n/6+2;
a[1]=1;
for(i=2;i<m;i++)
a[i]=0;
d=0;
for(i=2;i<=n;i++)
{
for(j=1;j<m;j++)
{
b=a[j]*i+d;
a[j]=b%1000000;
d=b/1000000;
}
if(d>0)
a[j]=d;
}
i=m;
r=1;
do
{i--;
r++;
}while(a[i]==0);
printf("%d!=",n);
for(i=r-15;i>=1;i--)
{
if(a[i]>99999)
{
printf("%d ",a[i]);
continue;}
else if(a[i]>9999)
{printf("0%d ",a[i]);
continue;
}
else if(a[i]>999)
{printf("00%d ",a[i]);
continue;}
else if(a[i]>99)
{printf("000%d ",a[i]);
continue;}
else if(a[i]>9)
{printf("0000%d ",a[i]);
continue;}
else
printf("000000%d ",a[i]);
}
}