Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

applet, xor, file, сети Петри, type, const, сервис, in, var, function, table, online, applet, variable, breakpoint, pascal, assembler, book of tasks on programming
 

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

Visual Basic. B.1. Nest of tasks. Operator If

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.1.1     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    k1 = 3
    k2 = 5
    k3 = 7
    If k1 > 1 Then
        If k2 < k3 Then
            dd = 4
        Else
            dd = 3
        End If
    Else
        dd = 2
    End If
    AA = dd
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.1.2     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    k1 = 3
    k2 = 5
    k3 = 7
    If k1 > 10 Then
        dd = 1
    Else
        If k1 Mod 3 = 1 Then
            dd = 2
        Else
            If k2 Mod 5 = 1 Then
                dd = 3
            Else
                If k3 Mod 3 = 2 Then
                    dd = 4
                Else
                    dd = 5
                End If
            End If
        End If
    End If
    AA = dd
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.1.3     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    k1 = 6
    k2 = 10
    k3 = 21
    If k1 > k2 Then
        dd = 1
    Else
        If k1 > k3 Then
            dd = 2
        Else
            If k1 + k2 > k3 Then
                dd = 3
            Else
                dd = 4
            End If
        End If
    End If
    AA = dd
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.1.4     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    k = 40
    If k Mod 3 = 0 Then
        dd = 1
    Else
        If k Mod 3 = 1 Then
            dd = 2
        Else
            If k Mod 3 = 2 Then
                dd = 3
            Else
                dd = 4
            End If
        End If
    End If
    AA = dd
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.1.5     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    k = 45
    If k / 3 = 13 Then
        dd = 1
    Else
        If k / 3 = 14 Then
            dd = 2
        Else
            If k / 3 = 15 Then
                dd = 3
            Else
                If k / 3 = 16 Then
                    dd = 4
                Else
                    dd = 5
                End If
            End If
        End If
    End If
    AA = dd
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.1.6     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    k = 44
    dd = 0
    If k Mod 2 = 0 Then
        dd = dd + 1
    End If
    If k Mod 3 = 1 Then
        dd = dd + 2
    End If
    If k Mod 5 = 4 Then
        dd = dd + 5
    End If
    If k Mod 6 = 4 Then
        dd = dd + 9
    End If
    AA = dd
End Function



 

©   Aliaksandr Prykhodzka    1993 - 2007