x = 0
y = 1
s = "abcdefghijklmnopqrstuvwxyz"
t = ""
While x <= 25
t = t & s.Substring(x, y)
x = 2 * x + 1
End While
s = t.Insert(3, "***")
WriteLine(s & x & y)
End Sub
Ans: Trace table:
x | y | s | t |
---|---|---|---|
0 | 1 | "abcdefghijklmnopqrstuvwxyz" | "" |
1 | 1 | "abcdefghijklmnopqrstuvwxyz" | "a" |
3 | 1 | "abcdefghijklmnopqrstuvwxyz" | "ab" |
7 | 1 | "abcdefghijklmnopqrstuvwxyz" | "abdh" |
15 | 1 | "abcdefghijklmnopqrstuvwxyz" | "abdhp" |
31 | 1 | "ab***dhp" | "abdhp" |
Output:
ab***dhp311
If a(0) > a(1) Then
t = a(1)
a(1) = a(0)
a(0) = t
End If
If a(1) > a(2) Then
t = a(2)
a(2) = a(1)
a(1) = t
End If
If a(0) > a(1) Then
t = a(1)
a(1) = a(0)
a(0) = t
End If
For Each t In a
WriteLine(t)
Next
End Sub
Ans: Trace table:
a(0) | a(1) | a(2) | t |
---|---|---|---|
6 | 2 | 3 | |
2 | 6 | 3 | 2 |
2 | 3 | 6 | 3 |
Ans: See the CountBlanks example.
Ans: See the Reverse1 example.
Ans: See the Reverse2 example.
Ans: See the VowelCount.
Ans: See the IsFourLetterWord.
Name | Gender | Age |
---|---|---|
Mary | F | 23 |
Robert | M | 31 |
Sally | F | 35 |
Jane | F | 28 |
Tony | M | 30 |
Alice | F | 41 |
Scott | M | 27 |
Larry | M | 49 |
Ans: See the DieRolls (W) example.
Ans: See the SnakeEyes (W) example.
End Sub
b = New Button
b.Location = New Point(50, 50)
b.Size = New Size(60, 100)
b.Text = "Push Me"
Me.Controls.Add(b)
b.Show()