Well since this thread is still going... the original question did ask for
the index and it would be important not to consider the initial maximum
value equal to zero... it should be set to the first element of the array
(all the values can be negative numbers).
So here is my solution:
Dim a() As Integer = {1, 3, 5, 15, 4, 99, 11}
Console.WriteLine(MaxIntegersIndex(a).ToString)
Console.WriteLine(MaxIntegersValue(a).ToString)
Public Function MaxIntegersIndex(ByVal a() As Integer) As Integer
MaxIntegersIndex = 0
For i As Integer = 1 To UBound(a)
If a(i) > a(MaxIntegersIndex) Then
MaxIntegersIndex = i
End If
Next
End Function
Public Function MaxIntegersValue(ByVal a() As Integer) As Integer
MaxIntegersValue = a(MaxIntegersIndex(a))
End Function