0
Module avgarr
    Function getavg(ByVal arr As Integer(), ByVal size As Integer) As Double
        Dim i As Integer
        Dim avg As Double
        Dim sum As Integer = 0
        For i = 0 To size - 1
            sum += arr(i)
        Next i
        avg = sum / size
        Return avg


    End Function
    Sub main()
        Dim bal As Integer() =( 1000,2,3,17,50)
        Dim avg As Double
        avg = getavg(bal, 5)
        Console.WriteLine("avg val is :{0}", avg)
        Console.ReadKey()

    End Sub
End Module

Its showing error at this line :
Dim bal As Integer() =( 1000,2,3,17,50)
The error is : Inset ')' after 1000.

One more error is :
avg = getavg(bal, 5)

It shows name 'bal' is not declared.

2
Contributors
1
Reply
9
Views
3 Years
Discussion Span
Last Post by Minimalist
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.