average on an array

Well could be there is a function wich does it, but if you were to do it manually then i would do it like this

dim average% = 0

For i as integer = 0 to array.length - 1
average += array(i)
next

average = average/array.length
 
i have an array that holds populations of countries and i would like to find the average population of all the countries, is there not a method or something htta would add all my populations and average them?
 
Back
Top