Advertisement
Alex_Fomin

Untitled

Jan 27th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.68 KB | None | 0 0
  1. function Fact(n: integer): longint;
  2. begin
  3.   Result := n <= 1 ? 1 : n * Fact(n - 1);
  4. end;
  5.  
  6. begin
  7.   var z, eps: real;
  8.   var w := 0.0;
  9.   var k := 1;
  10.  
  11.   repeat
  12.     z := ReadLnReal('Введите число Z (|Z| > 1):');
  13.     if Abs(z) <= 1 then WriteLn('Упс...ошибочка... :(');
  14.   until Abs(z) > 1;
  15.  
  16.   repeat
  17.     eps := ReadLnReal('Введите точность:');
  18.     if eps <= 0 then WriteLn('Упс...ошибочка... :(');
  19.   until eps > 0;
  20.  
  21.   while ((Power(z, k) / Fact(2 * k + 1)) + (1 / Power(z, 2 * k))) >= Eps do
  22.   begin
  23.     w += ((Power(z, k) / Fact(2 * k + 1)) + (1 / Power(z, 2 * k)));
  24.     k += 1;
  25.   end;
  26.  
  27.   WriteLn('Ответ: ', w);
  28. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement