1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
uses crt;
var i,n: integer;
function IsSimple(c: integer): boolean;
var j: integer;
begin
IsSimple:=true;
for j:=2 to c-1 do
if c mod j=0 then IsSimple:=false;
end;
begin
write('n='); readln(n);
for i:=2 to n do
if IsSimple(i) then write(i,' ');
end.