用pascal求100内素数

2025-03-01 01:20:07
推荐回答(1个)
回答1:

program sushu(input,output);
var
i,j:integer;
a:boolean;
begin
i:=2;
while i<=100 do
   begin
   a:=true;
   j:=2;//j:=2写在这个while 里面
   while j        begin
        if i mod j =0 then a:=false;
        j:=j+1;
        end;
   if a then write(i:3);
   i:=i+1;
   end;

end.