Общее задание: Определите, что будет напечатано в результате работы следующего фрагмента программы:
var k, s: integer;
begin
s:=2; k:=2;
while s
s:=s+k; k:=k+2;
end;
write(k);
end.
var k, s: integer;
begin
s:=0; k:=0;
while s
s:=s+k; k:=k+4;
end;
write(k);
end.
var k, s: integer;
begin
s:=0; k:=1;
while s
k:=k+3; s:=s+k;
end;
write(k);
end.
var k, s: integer;
begin
s:=5; k:=0;
while k
k:=k+2; s:=s+k;
end;
write(s);
end.
var k, s: integer;
begin
s:=0; k:=0;
while k
s:=s+2*k; k:=k+3;
end;
write(s);
end.
var k, s: integer;
begin
s:=0; k:=0;
while s
s:=s+2*k; k:=k+4;
end;
write(s);
end.
var k, s: integer;
begin
s:=1; k:=0;
while k
s:=s+2*k; k:=k+4;
end;
write(s+k);
end.
var n, s: integer;
begin
n := 3; s := 0;
while n
s:= s + n; n:= n + 1
end;
write(s)
end.
var n, s: integer;
begin
n := 4; s := 0;
while n
s:= s + n; n:= n + 1
end;
write(s)
end.
var n, s: integer;
begin
n := 4;s := 0;
while n
s := s + 15; n := n + 1
end;
write(s)
end.
var n, s: integer;
begin
n := 1; s := 0;
while n
s := s + 33; n := n + 1
end;
write(s)
end.
var n, s: integer;
begin
n := 1; s := 0;
while n
s := s + 7; n:= n + 1
end;
write(s)
end.
:
var n, s: integer;
begin
n := 0; s := 512;
while s = 0 do begin
s := s - 20;n := n + 1
end; write(n)
end.
:
var n, s: integer;
begin
n := 24; s := 0;
while n
s := s + 20; n := n + 2
end;
write(s)
end.
:
var n, s: integer;
begin
n := 12; s := 5;
while n
s := s + 12; n := n + 2
end;
write(s) end.
:
var n, s: integer;
begin
n := 2; s := 35;
while n
s := s + 20; n := n + 5
end;
write(s)
end.
:
var n, s: integer;
begin
n := 4; s := 15;
while s
s := s + 12; n := n + 2
end;
write(n)
end.
:
var n, s: integer;
begin
n := 0; s := 0;
while s
n := n + 1; s := s + 4
end;
write(n)
end.
:
var n, s: integer;
begin
n := 0;s := 0;
while s
s := s + 25; n := n + 1
end; write(n) end.
:
var n, s: integer;
begin
n:= 0; s:= 0;
while s
s:= s + 33; n:= n + 5
end;
write(n) end.
:
var n, s: integer;
begin
n:= 0;
s:= 0;
while s
s:= s + 36;
n:= n + 10
end;
write(n)
end.
:
var n, s: integer;
begin
n := 1;
s := 0;
while s
s := s + 36;
n := n * 2
end;
write(n)
end.
:
program B05;
var n, s: integer;
begin
n := 0;
s := 1;
while s
s := s * 3;
n := n + 3;
end;
write(n)
end.
10 http://kpolyakov.spb.ru