#include <stdio.h>
double fact( int n );
double factsum( int n );
int main()
{
int n;
scanf("%d",&n);
printf("fact(%d) = %.0f\n", n, fact(n));
printf("sum = %.0f\n", factsum(n));
return 0;
}
/* 你的代码将被嵌在这里 */
double fact(int n)
{
int i;
double m=1;
if(n==0)
return m;
else
for(i=1;i<=n;i++)
m=m*i;
return m;
}
double factsum(int n)
{
int j;
double sum;
sum=0;
if(n>0)
{
for(j=1;j<=n;j++)
sum+=fact(j);
}
return sum;
}