Source Code



Find The Maximun, Minimum and Average by Array

  • M. Taufik
  • Mar 19' 14
  • VB.NET
  • 393
  • 54
  • United States

Modul Array

Sub Main()
        Dim a() As Integer
        Dim i, index, max1, min1 As Integer
        Dim b As Double
        Dim temp As VariantType

        Console.Write("Input The Count of Number: ")
        index = Console.ReadLine
        ReDim a(index)
        Console.WriteLine()

        For i = 1 To index
            Console.Write("Input Number of " & i & ": ")
            a(i) = Console.ReadLine
            b += a(i)
        Next

        temp = a(0)
        For i = 1 To index
            If (a(i) > temp) Then
                temp = a(i)
            End If
        Next
        max1 = temp


        temp = a(1)
        For i = 1 To index
            If (a(i) < temp) Then
                temp = a(i)
            End If
        Next
        min1 = temp

        b = b / index

        Console.WriteLine()
        Console.WriteLine("The Maximum Number is {0}", max1)
        Console.WriteLine("The Minimum Number is {0}", min1)
        Console.WriteLine("The Average is {0:f}", b)

    End Sub

End Module
  • Tags :
comments powered by Disqus

Related Code

Know the number of odd or even !

Check two files are equal

Define binary type

Coloring Cells in a DBGrid

Coloring Cells in a StringGrid

Disable the Close X button on a Form

Activating the Start Menu by Code

Chart Line Using Morris

PHP vulnerability Scan Script

Fixed Header Menu CSS



Category