Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

object, язык программирования, лекция, inline, and, объяснения, html, symbol, file, if, examples, переход, трассировка, education, stack, электронный репетитор
 

for valuable work you must have JavaScript (allow active content)

Pascal. Pa.28. Nest of tasks. Tasks on substitution of conditions

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.1     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
begin
    k1:=0;    k2:=0;
    while ______ do begin
        k2:=k2+1;    k1:=k1+k2;
    end;
    k1:=k1+2;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.2     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
begin
    k1:=0;    k2:=0;
    while k2<2 do begin
        k2:=k2+1;
        while _________ do k1:=k1+1;
    end;
    k1:=k1+5;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.3     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
begin
    k1:=0;
    for k2:=1 to 10 do
        if __________ then k1:=k1+k2;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.4     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
begin
    k1:=1;
    for k2:=1 to 5 do
        if ________ then k1:=k1*k2;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.5     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
begin
    k1:=1;
    for k2:=1 to 10 do
        if ________ then k1:=k1*k2;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.6     Answer      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2, k3 : integer;
begin
    k1:=1;    k2:=0;    k3:=0;
    repeat
        k3:=k3+1;
        k2:=k2+k3;
        if _______ then k1:=k1*k2;
    until ______ ;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.7     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2, k3 : integer;
begin
    k1:=10;    k2:=10;    k3:=10;
    while ______ do k1:=k1 div 2;
    while ______ do k2:=k2 div 3;
    while ______ do k3:=k3 div 5;
    k1:=k1*k2*k3;
    writeln(k1);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.8     Answer      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k : integer;
begin
    k:=50;
    repeat
        k:=k-3;
        repeat
            k:=k+1;
        until _____ ;
    until _____ ;
    writeln(k);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.9     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
    pr : boolean;
begin
    pr:=true;    k1:=0;    k2:=0;
    while pr do begin
        k1:=k1+2;    k2:=k2+3;
        pr:= ______ ;
    end;
    k1:=(k1*k2) div (k1+k2);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.28.10     Answer      Java-analogue      Visual Basic-analogue

Put conditions into empty places to force the program will produce the number 30.


Program AA;
var
    k1, k2 : integer;
begin
    k1:=1;
    for k2:=1 to 3 do
    while ________ do k1:=k1+k2;
    writeln(k1);
end.

 

©   Aliaksandr Prykhodzka    1993 - 2007