Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

исключение, breakpoint, shr, var, counter, пролог, basic, type, bit, computer, Excel, cell, отчет, unit, online, open, jsp, критерий, учебный материал, xor, Internet
 

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

Visual Basic. B.11. Nest of tasks. Tasks on substitution of conditions

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.1     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 0
    k2 = 0
    While ___
        k2 = k2 + 1
        k1 = k1 + k2
    Wend
    k1 = k1 + 2
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.2     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 0
    k2 = 0
    While k2 < 2
        k2 = k2 + 1
        While ___
            k1 = k1 + 1
        Wend
    Wend
    k1 = k1 + 5
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.3     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 0
    For k2 = 1 To 10
        If (k2 > 5) And (k2 < 10) Then
            k1 = k1 + k2
        End If
    Next k2
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.4     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 1
    For k2 = 1 To 5
        If ___ Then
            k1 = k1 * k2
        End If
    Next k2
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.5     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 1
    For k2 = 1 To 10
        If k2 Mod 7 > 4 Then
            k1 = k1 * k2
        End If
    Next k2
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.6     Answer      Pascal-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 1
    k2 = 0
    k3 = 0
    Do
        k3 = k3 + 1
        k2 = k2 + k3
        If ___ Then
            k1 = k1 * k2
        End If
    Loop Until ___
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.7     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 10
    k2 = 10
    k3 = 10
    While ___
        k1 = k1 \ 2
    Wend
    While ___
        k2 = k2 \ 3
    Wend
    While ___
        k3 = k3 \ 5
    Wend
    k1 = k1 * k2 * k3
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.8     Answer      Pascal-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k = 50
    Do
        k = k - 3
        Do
            k = k + 1
        Loop Until ___
    Loop Until ___
    AA = k
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.9     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    pr = True
    k1 = 0
    k2 = 0
    While pr
        k1 = k1 + 2
        k2 = k2 + 3
        pr = ___
    Wend
    k1 = (k1 * k2) \ (k1 + k2)
    AA = k1
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.11.10     Answer      Pascal-analogue      Java-analogue

Put conditions into empty places to function AA return 30.


Function AA() As Integer
    k1 = 1
    For k2 = 1 To 3
        While ___
            k1 = k1 + k2
        Wend
    Next k2
    AA = k1
End Function



 

©   Aliaksandr Prykhodzka    1993 - 2007