Advertisement
Guest User

Teylor

a guest
Nov 22nd, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.82 KB | None | 0 0
  1. program Teylor;
  2. var n: integer;
  3.     toch, x, prev, itog, p: real;
  4.  
  5. begin
  6.     itog := 0;
  7.     p := 1;
  8.    
  9.     write('Синус - 1, косинус - 2: ');
  10.     readln(n);
  11.     write('Угол: ');
  12.     readln(x);
  13.     write('Точность: ');
  14.     readln(toch);
  15.    
  16.     if n = 1 then begin
  17.         prev := x;
  18.         itog := itog + prev;
  19.         while prev >= toch do begin
  20.             prev := prev * (((-1)*(x*x))/((p+1)*(p+2)));
  21.             p := p+2;
  22.             itog := itog + prev;
  23.         end;
  24.     end
  25.     else begin
  26.         p := 0;
  27.         prev := 1;
  28.         itog := itog + prev;
  29.         while prev >= toch do begin
  30.             prev := prev * (((-1)*(x*x))/((p+1)*(p+2)));
  31.             p := p+2;
  32.             itog :=  itog + prev;
  33.         end;
  34.      end;
  35.      write('Ответ: ');
  36.      writeln(itog);
  37. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement