PASCAL试题急!任给一个自然数n(n
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/31 22:27:58
![PASCAL试题急!任给一个自然数n(n](/uploads/image/z/955093-13-3.jpg?t=PASCAL%E8%AF%95%E9%A2%98%E6%80%A5%21%E4%BB%BB%E7%BB%99%E4%B8%80%E4%B8%AA%E8%87%AA%E7%84%B6%E6%95%B0n%28n)
PASCAL试题急!任给一个自然数n(n
PASCAL试题急!
任给一个自然数n(n
PASCAL试题急!任给一个自然数n(n
已全部补充完整,请查收
1
var n,i,s:int64;
begin
readln(n);
i:=2;
s:=0;
while i100000 then break;
end;
if s>100000 then continue;
if not a[s] and (si) then
begin
for j:=1 to s div 2 do
if s mod j=0 then
begin
w:=w+j;
if w>100000 then break;
end;
if w>100000 then continue;
if w=i then
begin
a[i]:=true;a[s]:=true;
writeln(i,' ',s);
end;
end;
end;
end;
end.
3
var i,j,n,s:longint;
begin
readln(n);
for i:=1 to n do
begin
s:=0;
for j:=1 to i div 2 do
if i mod j=0 then s:=s+j;
if s=i then writeln(i);
end;
end.
4
var s:real;
i,k:integer;
begin
readln(k);
s:=0; i:=1;
while s