Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Randomize() TextBox1.Text = "" Dim n As Integer = 10 Dim array(n) As Integer Dim summa, number As Integer Dim i As Integer summa = 0 number = 0 For i = 1 To n Step 1 array(i) = Int((100 * Rnd()) + 1) TextBox1.Text = TextBox1.Text & array(i) & " " If array(i) Mod 2 = 0 Then summa = summa + array(i) number = number + 1 End If Next i Label1.Text = "Сумма всех положитеьных чисел равна " & summa & ". И количество их равно " & number End Sub End Class
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Randomize()
TextBox1.Text = ""
Dim n As Integer = 10
Dim array(n) As Integer
Dim summa, number As Integer
Dim i As Integer
summa = 0
number = 0
For i = 1 To n Step 1
array(i) = Int((100 * Rnd()) + 1)
TextBox1.Text = TextBox1.Text & array(i) & " "
If array(i) Mod 2 = 0 Then
summa = summa + array(i)
number = number + 1
End If
Next i
Label1.Text = "Сумма всех положитеьных чисел равна " & summa & ". И количество их равно " & number
End Sub
End Class