Project Bilangan Pythagoras Delphi 7
Posted in DELPHI 7
.........PHYTAGORAS........
procedure TForm1.Button3Click(Sender: TObject);
var n,i,j,k,a,b,c:integer;
begin
n:=StrToInt(Edit1.Text);
For i:=1 to n do
begin
For j:=1 to i do
begin
for k:=1 to j do
begin
a:=i*i;
b:=j*j+k*k;
if a=b
then
begin
c:=c+1;
Listbox1.Items.Add('Bilangan Phytagoras-'+IntToStr(c)+':'+IntToStr(k)+','+IntToStr(j)+','+IntToStr(i));
end;
end;
end;
end;
end;
end.
procedure TForm1.Button3Click(Sender: TObject);
var n,i,j,k,a,b,c:integer;
begin
n:=StrToInt(Edit1.Text);
For i:=1 to n do
begin
For j:=1 to i do
begin
for k:=1 to j do
begin
a:=i*i;
b:=j*j+k*k;
if a=b
then
begin
c:=c+1;
Listbox1.Items.Add('Bilangan Phytagoras-'+IntToStr(c)+':'+IntToStr(k)+','+IntToStr(j)+','+IntToStr(i));
end;
end;
end;
end;
end;
end.
0 comments: