Циклы с известным числом повторения y=cos1!+cos2!+ cos3!+…+ cos5! — Pascal(Паскаль)

code:
# pascal
{$N+}

const
  MAXN = 100;

var
  n, i: longint;
  index: longint;
  y: extended;

begin
  writeln('Vychislyaem cos(1!) + cos(2!) + ... + cos(n!)');
  write('Vvedite "n": ');
  readln(n);
  index := 1;
  y := 0;
  for i := 1 to n do
  begin
    index := index * i;
    y := y + cos(index);
  end;
  writeln;
  writeln('y = ', y:0:5);
  readln;
  readln;

end.

Leave a Comment

2 + 1 =