25
Ноябрь
2009
Вывести на экран все четные элементы массива
Вывести на экран все четные элементы массива и определить количество нечетных элементов.
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n As Integer Dim A(n) As Integer Dim uneven As Integer Dim x As Integer For x = 0 To UBound(A) A(x) = x ^ 2 + 1 If A(x) Mod 2 = 0 Then TextBox1.Text = TextBox1.Text & vbCrLf & A(x) Else uneven = uneven + 1 End If Next TextBox1.Text = TextBox1.Text & vbCrLf & "нечетных чисел " & uneven End Sub End Class