Dim mas() As Integer
Dim mas1() As Integer
Dim a, i, kol1, max, max1, jmax, jmax1, allmax As Integer
Dim n, j, kol, k, l As Integer
Dim newmas() As Integer
Do
n = Val(InputBox("кол-во эл-тов 1-ого массива"))
Loop Until n <= 20
ReDim mas(n - 1)
For j = 0 To n - 1
mas(j) = Val(InputBox("Введите" + Str(j + 1) + "-ый элемент массива"))
Next
listbox1.items.clear()
For j = 0 To n - 1
listbox1.items.add(Str(j + 1) + ")" + Str(mas(j)))
Next
kol = 0
For j = 0 To n - 1
If mas(j) = 0 Then
kol = kol + 1
End If
Next
If kol = 0 Then
MsgBox("нет 0-ых элементов в 1-ом массиве")
End If
Do
a = Val(InputBox("кол-во эл-тов 2-ого массива"))
Loop Until n <= 15
ReDim mas1(a - 1)
For i = 0 To a - 1
mas1(i) = Val(InputBox("Введите" + Str(i + 1) + "-ый элемент массива"))
Next
ListBox2.Items.Clear()
For i = 0 To a - 1
ListBox2.Items.Add(Str(i + 1) + ")" + Str(mas1(i)))
Next
kol1 = 0
For i = 0 To a - 1
If mas1(i) = 0 Then
kol1 = kol1 + 1
End If
Next
If kol1 = 0 Then
MsgBox("нет 0-ых элементов в 2-ом массиве")
End If
max = mas(0) : jmax = 0
For j = 1 To n - 1
If mas(j) > max Then
max = mas(j)
jmax = j
End If
Next
max1 = mas1(0) : jmax1 = 0
For i = 1 To a - 1
If mas1(i) > max1 Then
max1 = mas1(i)
jmax1 = i
End If
allmax = max1 + max
Next
ListBox3.Items.Clear()
If kol > kol1 Then
For j = 0 To n - 1
ReDim Preserve newmas(k)
newmas(k) = mas(j)
If newmas(k) = 0 Then
newmas(k) = allmax
ListBox3.Items.Add(newmas(k))
End If
Next
End If
If kol < kol1 Then
For i = 0 To a - 1
ReDim Preserve newmas(k)
newmas(k) = mas1(i)
If newmas(k) = 0 Then
newmas(k) = allmax
ListBox3.Items.Add(newmas(k))
End If
Next
End If
End Sub