代码大全

(singke) #1

19.2


for i 1 to Num do


MeetsCriteria[i]:=True;


for i:=2 to Num/2 do
j:=j 1;


while j< Num do begin


meetsCriteria[i]:=False;
j:=j I;


end;


for i=1 to Num do


if Meetcriteria[i] then
writeln(i "meetsCriteria.");


for PrjmeCandidate := 1 to Num do


IsPrime[ PimeCandidate ] := True


for Factor := 2 to Num / 2 do


FactorableNumber := Factor Factor;


while( FactorableNumber <= Num ) do


begin


IsPrimes[ FactorableNumber ] := False;


FactorableNumber := FactorableNumber Factor;


end;


for PrimeCandidate := 1 to Num do


if IsPrime[ PrimeCandidate ] then


writeln ( PrimeCandidate , ’is prime.’ );


1 Num

Free download pdf