1.
var p,a,k,pr:integer;
begin
write('p = '); readln(p);
a:=1; k:=1; pr:=1;
repeat
a:=a+2;
k:=k+1;
pr:=pr*a;
until pr=p;
writeln('k = ',k);
end.
Пример:
p = 945
k = 5
2.var a,s,k:integer;
begin
s:=0; k:=0;
write('a = '); readln(a);
repeat
s:=s+a;
k:=k+1;
write('a = '); readln(a);
until a=0;
writeln('s = ',s,' sr = ',s/k);
end.
Пример:
a = 2
a = 4
a = 3
a = 1
a = 5
a = 0
s = 15 sr = 3