Minggu, 30 Oktober 2016

Program Delphi Untuk Mencetak Deret "1.2.3 + 2.3.4 + ... + (n-1).n.(n+1) + n.(n+1).(n+2)

procedure TDeret4.Button18Click(Sender: TObject);
Var
  i,n,k,l,m,o:integer;

begin
  n:=strtoint(edit13.Text);
  k:=0;
  for i:=1 to n do
  begin
  l:= (i*(i+1)*(i+2)) ;
  listbox6.items.add(inttostr(l)) ;
  k:= (k+l);
end;
edit14.text:=inttostr(k);


end;

procedure TDeret4.Button19Click(Sender: TObject);
begin
edit13.text:='';
listbox6.Items.clear;
edit14.text:=' ';

end;

procedure TDeret4.Button20Click(Sender: TObject);
begin
Deret.Show;
Deret4.Hide;
end;

0 komentar:

Posting Komentar