题目: |
program sx201605;
var ss:array [1..1000] of integer;
i,k: integer;
begin
for i:=l to 20 do ss[i]:=i;
ss[1]:=0;
i:=2;
while i<=20 do
begin
k:=i;
while k+i<=20 do
begin
k:=k+i;
ss[k]:=0;
end;
i:=i+1;
while ss[i]=0 do i:=i+l;
end;
for i:=l to 20 do if ss[i]<>0 then write(ss[i], ' ' );
writeln
end. 输出:2 3 5 7 11 13 17 19
|