Thema: Primzahl

Einzelnen Beitrag anzeigen

Benutzerbild von Wolfgang Mix
Wolfgang Mix

Registriert seit: 13. Mai 2009
Ort: Lübeck
1.222 Beiträge
 
Delphi 2005 Personal
 
#6

AW: Primzahl

  Alt 17. Mai 2011, 18:06
Delphi-Quellcode:
while zahl<=n do
begin
  prim:=true;
  teiler:=zahl;
  wurzel:=sqrt(n);
  while (teiler <= wurzel) and (prim) do
  begin
    if zahl mod teiler:=0 then prim := false;
    teiler:=teiler + 1 ;
  end;
  inc(zahl) //hier
end;
Wolfgang Mix
if you can't explain it simply you don't understand it well enough - A. Einstein
Mein Baby:http://www.epubli.de/shop/buch/Grund...41818516/52824
  Mit Zitat antworten Zitat