Паскаль! заменить for на while!
var a,b,c,s1,s2,k,i: integer;
begin
write('a, b, c: ');
readln(a,b,c);
s1: =0;
for i: =1 to b do s1: =s1+a;
s2: =0;
for i: =1 to c do s2: =s2+c;
writeln('s1 = ',s1,' s2 = ',s2);
k: =0;
while s1> s2 do begin k: =k+1; s1: =s1-s2; end;
k: =k+1;
writeln('k = ',k);
end.
пример:
a, b, c:
4 7 3
s1 = 28 s2 = 9
k = 4
var a,b,c,s1,s2,k,i:integer;
begin
i := 1;
write('a, b, c:');
readln(a,b,c);
s1 := 0;
while i<=b do
begin
s1 := s1+a;
i := i + 1;
end;
s2 := 0;
i := 1;
while i<=c do
begin
s2 := s2+c;
i := i + 1;
end;
writeln('s1 = ',s1,' s2 = ',s2);
k:=0;
while s1>s2 do begin k:=k+1; s1:=s1-s2; end;
k:=k+1;
writeln('k = ',k);
end.