PROJECT DEKOMPOSISI N BUAH BILANGAN (DELPHI 7)
Posted in DELPHI 7
..............DEKOMPOSISI BILANGAN N.........
procedure TForm1.Button1Click(Sender: TObject);
var i,a,b:integer;
k:real;
begin
a:=StrToInt(Edit1.Text);
i:=2;
b:=a;
while i<=a do
begin
if b mod i=0
then
begin
Listbox1.Items.Add(IntToStr(i));
k:=b/i;
b:=trunc(k);
end
else i:=1+i;
end;
end;
end.
procedure TForm1.Button1Click(Sender: TObject);
var i,a,b:integer;
k:real;
begin
a:=StrToInt(Edit1.Text);
i:=2;
b:=a;
while i<=a do
begin
if b mod i=0
then
begin
Listbox1.Items.Add(IntToStr(i));
k:=b/i;
b:=trunc(k);
end
else i:=1+i;
end;
end;
end.
0 comments: