Function sum(x:real; n:integer):real;
begin
if n=0
then sum:=0
else sum:=sum(x,n-1)+sin(n*x)
end;
var x:real;n:integer;
begin
write('x = ');
readln(x);
write('n = ');
readln(n);
writeln('Sum = ',sum(x,n));
end.
Пример:
x = 1
n = 4
Sum = 1.13508592438552