{ PRVOCISLO.PAS Copyright (c) Pavel Patak } { Zjisti, zda je zadane cislo prvocislem } { } { Datum:28.10.2004 http://www.trsek.com } Program Prvocislo; Var P,I : Integer; Delitelu : Integer; Begin Write('Zadej cislo : '); Readln(P); Delitelu:=0; Writeln; For I:=2 to Trunc(Sqrt(p)) do {Hledame delitele} if P mod I = 0 then Delitelu:=Delitelu+1; if (Delitelu = 0) and (P>1) then Writeln('Je to prvocislo.') else Writeln('Neni to prvocislo.'); {Cislo mensi nez 2 nemuze byt prvocislem, bez ohledu na pocet delitelu} Readln; End.