Minggu, 30 Oktober 2016

Program Delphi Untuk Mencetak Deret "1/2 + 2/3 + 3/4 + ... + 99/100"

procedure TDeret2.Button12Click(Sender: TObject);
var
  i,a:integer;
  n,k,b,j,c:real;
begin
  j:=0;
  for i:=1 to 99 do
  begin
  a:=i;
  b:=i+1;
  c:=a/b;
  Listbox4.Items.add(floattostr(c));
  j:=j+c;
  end;

  edit10.text:=floattostr(j);




end;

procedure TDeret2.Button13Click(Sender: TObject);
begin
listbox4.items.clear;
edit10.Text:=' ';

end;

procedure TDeret2.Button14Click(Sender: TObject);
begin
Deret.Show;
Deret2.Hide;
end;

0 komentar:

Posting Komentar