Var n,i,s,p:integer;
begin
write('n = ');
readln(n);
//а
s:=0; p:=1;
for i:=1 to n do
begin
s:=s+(2*i-1); p:=p*(2*i-1);
end;
writeln('s = ',s,' p = ',p);
//б
s:=0; p:=1;
for i:=1 to n do
begin
s:=s+2*i; p:=p*(2*i);
end;
writeln('s = ',s,' p = ',p);
//в
s:=0; p:=1;
for i:=1 to n do
begin
s:=s+3*i; p:=p*(3*i);
end;
writeln('s = ',s,' p = ',p);
//в
s:=0; p:=1;
for i:=1 to n do
begin
s:=s+4*i; p:=p*(4*i);
end;
writeln('s = ',s,' p = ',p);
end.
Пример:
n = 4
s = 16 p = 105
s = 20 p = 384
s = 30 p = 1944
s = 40 p = 6144