procedure TForm15.Button2Click(Sender: TObject);
Var i,n,m,sisa:Integer;
p:boolean;
begin
m:=StrToInt(Edit1.Text);
ListBox1.Items.Add(IntToStr(2));
for n:=3 to m do
begin
p:=true;
i:=2;
while(ibegin
sisa:=n mod i;
if sisa=0 then p:=false;
i:=i+1;
end;
if p=true then ListBox1.Items.Add(IntToStr(n));
end;
end;
CONVERSATION
Subscribe to:
Post Comments
(
Atom
)
0 komentar:
Post a Comment