Book of tasks on programming. Old version

 

 by Aliaksandr N. Prykhodzka

 

record, процедурный, справка, form, var, система счисления, MYSQL, education, по программированию, repeat, class, file, stack, destructor, тестирование
 

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

Visual Basic. B.8. Nest of tasks. Strings

 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.1     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As Integer
    Stri = "a"
    For i = 1 To 4
        Stri = Stri + Stri
    Next i
    Man = Len(Stri)
    AA = Man
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.2     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    a = "a"
    b = "b"
    For k = 1 To 3
        a = a + b
        b = b + a
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.3     Answer      Pascal-analogue

Determine a value produced by function AA


Function AA() As String
    a = "a"
    b = "b"
    Do
        a = a + b
        b = b + a
    Loop Until Len(b) > 5
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.4     Answer      Pascal-analogue

Determine a value produced by function AA


Function AA() As String
    a = "a"
    b = "b"
    Do
        a = a + b
        b = b + a
    Loop Until Len(b) > 2 * Len(a)
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.5     Answer      Pascal-analogue

Determine a value produced by function AA


Function AA() As Integer
    a = "a"
    b = "b"
    Do
        For k = 1 To Len(b)
            a = a + a
        Next k
        For k = 1 To Len(a)
            b = b + b
        Next k
    Loop Until Len(b) > 100
    Man = Len(b)
    AA = Man
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.6     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    b = ""
    For k = 1 To 5
        b = b + Chr(Asc("b") + Len(b))
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.7     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    a = "abcdef"
    b = ""
    For k = 1 To 3
        b = b + Mid(a, k * 2 - 1, 1)
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.8     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    b = ""
    For ch = Asc("a") To Asc("f")
        b = b + Chr(ch)
    Next ch
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.9     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    b = "b"
    For k = 1 To 3
        b = "a" + b + "a"
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.10     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    b = "b"
    For k = 1 To 3
        b = b + "a" + b
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.11     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    b = "b"
    For k = 1 To 2
        b = Left(b, 1) + Right(b, 1) + b
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.12     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA


Function AA() As String
    b = "abc"
    For k = 1 To 2
        b = b + Mid(b, k, 1)
    Next k
    AA = b
End Function


 

 

Calculator

/ - division

\ - rest

S - sum of numbers from and to

P - multiply numbers from and to

B.8.13     Answer      Pascal-analogue      Java-analogue

Determine a value produced by function AA .


Function AA() As Integer
    Stri = "bb"
    For i = 1 To 5
        Stri = Stri + Stri
    Next i
    AA = Len(Stri)
End Function


 

©   Aliaksandr Prykhodzka    1993 - 2007