Var n, i: integer; p: real; begin write('n = '); readln(n); i:=0; p:=1; repeat i:=i+1; p:=p*(2*i-1)/(2*i); until i = n; writeln('Произведение: ', p:7:5); end.
Program calc; var n, u, d: integer; f: real; begin write('n = '); readln(n); u := 1; d := 2; f := 1; repeat f := f * (u / d); u := u + 1; d := d + 1; until d > (2 * n); writeln('Произведение: ', f:1:5); end.
begin
write('n = ');
readln(n);
i:=0;
p:=1;
repeat
i:=i+1;
p:=p*(2*i-1)/(2*i); until i = n;
writeln('Произведение: ', p:7:5);
end.
Пример:
n = 5
Произведение: 0.24609
var
n, u, d: integer;
f: real;
begin
write('n = ');
readln(n);
u := 1;
d := 2;
f := 1;
repeat
f := f * (u / d);
u := u + 1;
d := d + 1;
until d > (2 * n);
writeln('Произведение: ', f:1:5);
end.