# Visual basic program to find max and min element from an array

How to write a visual basic program to find the maximum and minimum number from an array. How to Add and get the elements from an array in visual basic.

Find a Max and Min number from an array in the visual basic program is really simple. but before directly jump to code let’s see how to Add and retrieve elements from an array in visual basic.

## Visual basic program to Add and Retrieve values from an array

```Module Module1

Sub Main()
'Declaration an array
Dim a(5), i As Integer
a(0) = 10
a(1) = 13
a(2) = 20
a(3) = 25
a(4) = 30
a(5) = 35
'Retrive the value from an array
For i = 0 To a.Count - 1
Console.WriteLine(a(i))
Next
End Sub

End Module
```

## Vb program to Find Max and Min element in the array

Vb library contains lots of predefined method to make the task easy for programmers and a.MAX  and a.Min is used to find the maximum and minimum number from an array. Below is an example

```Module Module1

Sub Main()
'Declaration an array
Dim a(5), i, sum As Integer
sum = 0
a(0) = 10
a(1) = 13
a(2) = 20
a(3) = 25
a(4) = 30
a(5) = 35

Console.WriteLine("Max Number is: " & a.Max)
Console.WriteLine("Min Number is: " & a.Min)
End Sub

End Module
```

## Output:

Max Number is: 35

Min Number is: 10

## Check out more related visual basic program with example

Vb program to find the sum of digit

Vb Program to create the multiplication table