hi wollte auchmal was posten.
Delphi-Quellcode:
uses
math;
Function IsPrim(zahl : Integer): boolean;
var
i: integer;
begin
result := true;
If zahl = 1 then
begin
result := false;
exit;
end;
For i := 2 to Trunc(sqrt(zahl))+1 do
begin
If ((zahl mod i) = 0) then
begin
result := false;
exit;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
for i := 0 to 1000 do
begin
if isprim(i) then memo1.Lines.Add(inttostr(i));
end;
end;