2. 1!+2!+ ... ... +n!

program exLoop2_1;
var
    sum, i, n, factorial : integer;
begin
     write('Please input a positive: ');
     readln(n);
     factorial := 1;
     for i := 2 to n do
     begin
          factorial := factorial*i;
          sum := sum+factorial;
     end;
     writeln(sum+1);
     readln;
end.
posted @ 2010-01-01 21:16  SmartIOI  阅读(102)  评论(0)    收藏  举报
本站采用CC授权如需转载、引用文章,请务必附上作者及来源处。 Creative Commons License