Sub dodawanie() Dim n As Integer Dim t As Integer n = 21 t = 5 z = t + 1 While (n > 1) t = t + z z = z + 1 n = n - 1 Wend Range("A1") = t End Sub
Sub średnia() Dim s As Integer Dim n As Integer n = 4 s = 1 t = s i = s + 1 While i <= (n + t - 1) s = s + i i = i + 1 Wend x = s / n Range("A1") = x End Sub
Sub kwadraty() Dim a As Integer Dim n As Integer a = 7 n = 6 t = a While a <= (n + t - 1) x = a ^ 2 Range("A1").Offset(a - t, 0) = x a = a + 1 Wend End Sub
Sub bank() Dim x As Double Dim y As Double Dim z As Integer x = 3 y = 5000 z = 7 s = y i = (1 + x / 100) n = 1 While n <= z s = s * i s = s + x n = n + 1 Wend Range("A1") = s End Sub
Sub tabliczka() Dim w As String Dim x As Integer Dim y As Integer Dim t As Integer Dim z As Integer Dim s As String
x = 0 y = 0 t = y
While x <= 10 For t = 0 To 10 z = x * t s = x w = s + "*" s = t w = w + s + "=" s = z w = w + s Range("A1").Offset(x, t) = w t = t + 1 Next t