Imports System
Module ArraySum
Sub Main()
Console.Clear()
Console.WriteLine("Find Total of Values in an Array in VB!")
' Note this alternate way to declare and assign array Values
' There is no SIZE in the round brackets ...
' ... it is set by the number of values in curly brackets
Dim aiData() As Integer = { 5, 7, 33, 22, 8 }
'MODIFY code to LOOP through the array and add each value to a total
' Note: replace MsgBox() with Console.WriteLine() to show the total
Dim total as Integer = 0
For i = 0 to 4
Console.WriteLine(aiData(i))
total = total + aiData(i)
Next
Console.Writeline("The total is " + total.ToString())
End Sub
End Module