用什么语言?
使用ASP VB
for i=1 to 10
for j=1 to i
sum1=sum1*j
next
sum=sum+(-1)^(i-1)
next
response.write "值为:"&sum
若是其它语言也是一样的思路.
就是 -1的(i-1)次方乘以i的阶乘之和
#include
int multiple(int);
main()
{
int i,n,flag;
int sum;
for(sum=0,flag=-1,i=1;i<=10;i++){
sum+=(flag*(-1))*multiple(i);
flag*=-1;
}
printf("the answer is %d\n",sum);
}
int multiple(int n)
{
int temp,i;
int answer;
for(answer=1,i=1;i<=n;i++)
answer*=i;
return answer;
}
临时写的,能算出来
#include
unsigned int jiecheng(unsigned int data)
{
unsigned int value=1;
int i=1;
value
for(i=1;i<=data;i++)
{
value=i*value;
}
return(value);
}
void main()
{
int i=1;
unsigned int temp=0,value=0;
while(i<=10)
{
temp=jiecheng(i);
value=value+temp;
}
printf("the result is %d\n",value);
}