program CalculateZ;
varn, i: integer;z: integer;
beginwrite('Enter a natural number n: ');readln(n);
z := 1;
for i := 1 to n dobeginz := z (3 i - 1);end;
writeln('The result is: ', z);end.
program CalculateZ;
var
n, i: integer;
z: integer;
begin
write('Enter a natural number n: ');
readln(n);
z := 1;
for i := 1 to n do
begin
z := z (3 i - 1);
end;
writeln('The result is: ', z);
end.