Senin, 22 Juni 2015

Tugas penggunaan Deret







List Program
unit deretpola;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Memo1: TMemo;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  x,y,z,i:integer;
begin
  x:=strtoint(Edit1.Text);
  Memo1.Clear;
  i:=-1;
  z:=-2;
  while i<=x do
  begin
    y:=i;
    Memo1.Lines.Add(inttostr(y));
    i:=(y+z)*-1;
    z:=z*-1;
  end;
end;

end.
List Program
Hasil Running


0 komentar:

Posting Komentar

Categories

Total Tayang

Jam

Kalender Islam

Diberdayakan oleh Blogger.

Popular Posts

Pengikut