procedure TForm1.KeluarClick(Sender: TObject);
begin
close;
end;
procedure TForm1.ForToDoClick(Sender: TObject);
var
i,j : integer; b:string;
begin
b:='';j:=2;
for i:=1 to 10 do
begin
b:=b+inttostr(j)+'';
j:=j+2;
end;
panel1.caption:=b;
end;
procedure TForm1.ForDowntoDoClick(Sender: TObject);
var
i,j : integer; b:string;
begin
b:='';j:=2;
for i:=10 downto 1 do
begin
b:=b+inttostr(i)+'';
j:=j+2;
end;
panel2.caption:=b;
end;
procedure TForm1.WhileDoClick(Sender: TObject);
var
i,j : integer; b:string;
begin
i:=1;
b:='';
while i<=10 do
begin
b:=b+inttostr(i)+'';
i:=i+2;
end;
panel3.caption:=b;
end;
procedure TForm1.RepeatUntilClick(Sender: TObject);
var
i,j : integer; b:string;
begin
i:=1;
b:='';
repeat
b:=b+inttostr(i)+'';
i:=i+1;
until i>10;
panel4.caption:=b;
end;
procedure TForm1.PangkatClick(Sender: TObject);
var
bil,hasil,pangkat,a : integer;
begin
bil:=strtoint(edit1.Text);
hasil:=bil;
pangkat:=strtoint(edit2.Text);
if edit2.Text='0' then edit3.Text:='1' else
if edit2.Text='1' then edit3.Text:=edit1.Text else
begin
for a:=2 to pangkat do
hasil:=hasil*bil;
edit3.Text:=inttostr(hasil);
end;
end;
end.
12 tahun yang lalu
0 komentar:
Posting Komentar
Isikan komentar anda dengan baik dan bermanfaat.. ^_^