Var i, N, M : word; s : double; function fac(z : word) : longint; begin if (z <= 1) then fac := 1 else fac := fac(z - 1) * z; end; begin repeat writeln('введите N и M (от 3 до 36)'); readln(N, M); until (N >= 3) and (N < M) and (M <= 36); s := 0; for i := N to M do begin s := s + (cos(n)) / (fac(i - 3)); end; writeln('сумма ряда на интервале [', N, ',', M, '] = ', s) end.
s : double;
function fac(z : word) : longint;
begin
if (z <= 1) then
fac := 1
else
fac := fac(z - 1) * z;
end;
begin
repeat
writeln('введите N и M (от 3 до 36)');
readln(N, M);
until (N >= 3) and (N < M) and (M <= 36);
s := 0;
for i := N to M do
begin
s := s + (cos(n)) / (fac(i - 3));
end;
writeln('сумма ряда на интервале [', N, ',', M, '] = ', s)
end.