求1!+2!+3!+4!+…+n!的值
流程图和伪代码
参考答案:i = 0,sum = 0,factor = 1
_________i = i + 1
| i>n? y-> 结束
| | no
| factor = factor * i
| sum = sum + factor
| |
------------
initialize:
i = 0; sum = 0; factor = 1;
for i = 1 to n
factor = factor * i
sum = sum+ factor;
endfor
return sum;