Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

кобол, paste, частота, винчестер, variable, prolog, синтаксис, applet, inline, учебник, сети Петри, const, tasks, label, void, функциональный, insert, interrupt
 

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

Pascal. Pa.39. Nest of tasks. Tasks on substitution of operators

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.1     Answer      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 15 *)
var
    a, s : integer;
begin
    a:=0;        s:=0;
    repeat
        a:=a+1;
        _____ ;
    until a=5;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.2     Answer      Java-analogue      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 40 *)
var
    i, s : integer;
begin
    s:=0;
    for i:=1 to 5 do ______ ;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.3     Answer      Java-analogue      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 21 *)
var
    i, s : integer;
begin
    s:=0;
    for i:=1 to 5 do
        if i mod 2 = 0 then ______
        else ______ ;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.4     Answer      Java-analogue      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 18 *)
var
    i, s : integer;
begin
    s:=0;
    for i:=1 to 5 do
        if i mod 3 > 0 then ____
        else ____ ;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.5     Answer      Java-analogue      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 30 *)
var
    j, i, s : integer;
begin
    s:=0;
    for i:=1 to 3 do
        for j:=1 to i do _____ ;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.6     Answer      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 5 *)
var
    s : integer;
begin
    _______ ;
    if s=5 then repeat until false;
    while s>16 do ______ ;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.7     Answer      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 45 *)
var
    s : integer;
begin
    ______ ;
    repeat
        ______
    until s>31;
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.8     Answer      Java-analogue      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 53 *)
var
    i, s : integer;
    A : array[1..4] of integer;
begin
    for i:=1 to 4 do ______ ;
    s:=0;
    for i:=1 to 3 do s:=s+A[i]*A[i+1];
    writeln(s);
end.

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

Pa.39.9     Answer      Java-analogue      Visual Basic-analogue

Put operators (as y:=y+ ... or y:=y- ...) into empty places to program write the given number. You may use operator as "y:=number" at extreme case (for example, if it is the first operator of program).


Program AA;        (* 90 *)
var
    k, s, i, j : integer;
begin
    s:=0;
    for i:=1 to 3 do _________ ;
    k:=0;
    for j:=1 to 4 do _________ ;
    s:=s*k;
    writeln(s);
end.

 

©   Aliaksandr Prykhodzka    1993 - 2007