100-1000 素数之和

来源:学生作业帮助网 编辑:六六作业网 时间:2024/05/24 10:19:08
100-1000素数之和100-1000素数之和100-1000素数之和pascal:vars,i,x,t:longint;begins:=0;forx:=100to1000dobegint:=0;f

100-1000 素数之和
100-1000 素数之和

100-1000 素数之和
pascal:
var
s,i,x,t:longint;
begin
s:=0;
for x:=100 to 1000 do begin
t:=0;
for i:=1 to x do if x mod i=0 then t:=t+1;
if t=2 then s:=s+x;
end;
writeln('S=',s);
end.