Var s,ds:real; k1,k2:integer;
begin
//a
s:=1000; ds:=0; k1:=0;
while ds<=30 do<br> begin
ds:=s*0.02;
s:=s+ds;
k1:=k1+1;
end;
writeln('k1 = ',k1);
//б
s:=1000; ds:=0; k2:=0;
while s<=1200 do<br> begin
s:=1.02*s;
k2:=k2+1;
end;
writeln('k2 = ',k2);
end.
Результат:
k1 = 22
k2 = 10