HRAshtonvar S: real; i, k, l: integer; begin S := 1; for i := 1 to 12 do begin k := 1; l := 1; while (k <= i) do begin l := l * 3; k := k + 1; end; S := S + 1 / l; end; writeln(S); end. ------------- function len(s: integer): byte; var i, l: byte; begin l := s; while (l > 0) do begin l := l div 10; inc(i); end; len := i; end;
var i: integer; begin i := 3; repeat i := i * 3; until (len(i) = 6); writeln(i); end. --------------- var D, x: real; y: integer; begin readln(x); if (x > 0) then for y := 1 to 5 do D := D + (y + cos(x)) else begin D := 1; while (y <= 10) do begin D := D * (y - x); inc(y); end; end; writeln('D = ', D); end.
Answers & Comments
S: real;
i, k, l: integer;
begin
S := 1;
for i := 1 to 12 do
begin
k := 1; l := 1;
while (k <= i) do
begin
l := l * 3;
k := k + 1;
end;
S := S + 1 / l;
end;
writeln(S);
end.
-------------
function len(s: integer): byte;
var
i, l: byte;
begin
l := s;
while (l > 0) do
begin
l := l div 10;
inc(i);
end;
len := i;
end;
var
i: integer;
begin
i := 3;
repeat
i := i * 3;
until (len(i) = 6);
writeln(i);
end.
---------------
var
D, x: real;
y: integer;
begin
readln(x);
if (x > 0) then
for y := 1 to 5 do
D := D + (y + cos(x))
else
begin
D := 1;
while (y <= 10) do
begin
D := D * (y - x);
inc(y);
end;
end;
writeln('D = ', D);
end.