# program p8_3_a uses crt function fac integer longint var integer longi

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58``` ```program p8_3_a; uses crt; function fac(n : integer) : longint; var i : integer; f : longint; begin f := 1; for i := 2 to n do f := f * i; fac := f; end; function power(v : real; p : integer) : real; var r : real; begin if (v = 0) then r := 0 else if (p = 0) then r := 1 else begin r := 1; while (p > 0) do begin if ((p and 1) = 1) then r := r * v; p := p shr 1; v := v * v; end; end; end; function fs(n : integer; x : real; a : real) : real; var k : integer; s: real; begin k := 0; s := 0; repeat s := s + power(x, k) * sin(a + k*pi/2)/fac(k); k := k + 1; until k > n; fs := s; end; var n : integer; s, a, x : real; begin clrscr; write('Vvedit n = '); readln(n); write('Vvedit a = '); readln(a); write('Vvedit x = '); readln(x); s := fs(n, a, x); writeln('s = ', s:2:20); readln; end. ```