Program name; var a,b,s,p:real; begin write('B = ');readln(b); write('a = ');readln(a); s:=0; p:=a; while p<b do begin s:=s+a; write('a = '); readln(a); p:=p*a; end; writeln('s = ',s); end.
Пример: B = 10000 a = 5 a = 8 a = 7 a = 4 a = 6 a = 2 s = 30
var a,b,s,p:real;
begin
write('B = ');readln(b);
write('a = ');readln(a);
s:=0; p:=a;
while p<b do
begin
s:=s+a;
write('a = ');
readln(a);
p:=p*a;
end;
writeln('s = ',s);
end.
Пример:
B = 10000
a = 5
a = 8
a = 7
a = 4
a = 6
a = 2
s = 30