Module Module1
Sub Main()
Dim arr() As Integer = {1, 2, 3, 4, 5, 6, 7}
Dim sum As Integer
For i As Integer = 0 To arr.Length - 1
If (arr(i) Mod 2 = 0) Then
sum += arr(i)
End If
Next
Console.WriteLine("sum = {0}", sum)
End Sub
End Module
'run:
'
'sum = 12