Public Class Form1
Sub vivod_array(ByVal x() As Double, ByVal t As TextBox)
Dim i As Integer
For i = 0 To UBound(x)
t.Text = t.Text + Format(x(i), "00.00") + Space(1)
Next
End Sub
Sub vivod(ByVal d As Double, ByVal t As TextBox)
t.Text = CStr(d)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a(19) As Double
Dim i As Integer
Dim first, second As Integer
first = -1
second = -1
Randomize()
For i = 0 To UBound(a)
a(i) = -20 * Rnd() + 11
If (a(i) < 0) Then
If first = -1 Then
first = i
Else
If (first > -1) And (second = -1) Then
second = i
End If
End If
End If
Next
Dim z() As Double
Dim n As Integer
Dim summ As Double
ReDim z(second - first - 2)
For i = first + 1 To second - 1
z(n) = a(i)
n = n + 1
summ = summ + a(i)
Next
vivod_array(a, TextBox1)
vivod_array(z, TextBox2)
vivod(summ, TextBox3)
End Sub
End Class