W whirlwindboy Unregistered / Unconfirmed GUEST, unregistred user! 2004-05-22 #1 []设计程序,求s=1+(1+2)+(1+2+3)+(1+2+3+4)+……+(1+2+……+n)的值。 帮忙一下怎样写程序
Z zurich Unregistered / Unconfirmed GUEST, unregistred user! 2004-05-22 #2 var i,j:integer; sum,sum1:integer; begin sum1:=0; for i:=1 to strtoint(edit1.Text) do begin sum:=0; for j:=1 to i do begin sum:=sum +j ; end; sum1:=sum1+sum; end; showmessage(inttostr(sum1)); end; 添加一个button,一个edit
var i,j:integer; sum,sum1:integer; begin sum1:=0; for i:=1 to strtoint(edit1.Text) do begin sum:=0; for j:=1 to i do begin sum:=sum +j ; end; sum1:=sum1+sum; end; showmessage(inttostr(sum1)); end; 添加一个button,一个edit