主题:超级简单题
qwertyiop
[专家分:10] 发布于 2009-04-13 19:09:00
1.100以内所有素数
回复列表 (共6个回复)
沙发
日奈森亚梦 [专家分:150] 发布于 2009-04-13 19:11:00
program blf;
const
a=2;b=3;c=5;d=7;
var m:integer;
begin
write(a:5);write(b:5);write(c:5);write(d:5);
for m:=2 to 100 do
if (m mod 2<>0) and (m mod 3 <>0) and (m mod 5<>0) and (m mod 7<>0) then
write(m:5);
end.
板凳
w75317 [专家分:530] 发布于 2009-04-15 17:53:00
program ab;
const
a=2;b=3;c=5;d=7;
var m:integer;
begin
write(a:5);write(b:5);write(c:5);write(d:5);
for m:=2 to 100 do
if (m mod 2<>0) and (m mod 3 <>0) and (m mod 5<>0) and (m mod 7<>0) then
write(m:5);
end.
3 楼
woshizhu [专家分:30] 发布于 2009-04-15 20:51:00
program blf;
const
a=2;b=3;c=5;d=7;
var m:integer;
begin
write(a:5);write(b:5);write(c:5);write(d:5);
for m:=2 to 100 do
if (m mod 2<>0) and (m mod 3 <>0) and (m mod 5<>0) and (m mod 7<>0) then
write(m:5);
end.
4 楼
szc123 [专家分:80] 发布于 2009-04-16 21:43:00
输入N
打印2至N的所有素数
program example;
var f,i,j,n:integer;
begin
read (n);
for i:=2 to n do begin
f:=1;
for j:=2 to trunc(sqrt(i)) do begin
if i mod j=0 then f:=0
end;
if f=1 then write(i,' ');
end;
end.
5 楼
hxy_anhui [专家分:320] 发布于 2009-05-23 10:55:00
var n,i,j,a:longint;
begin
readln(n);
for i:=1 to n do
begin
a:=0;
for j:=1 to trunc(sqrt(i)) do
if i mod j=0 then a:=a+1;
if a:=2 then write(i,' ');
end;
end.
6 楼
tzhlryy [专家分:270] 发布于 2009-08-01 10:51:00
lz是不是人啊
我来回复