Jump to content
Sign in to follow this  

Get the average of all values in a one dimensional array

Recommended Posts


How do I find the total and the average of all values in an array?

*edit* Nevermind...Figured it out.

#include <Array.au3>

Dim $avArray[11], $I = 1

$total = 0

; Populate test array.

For $I = 1 to UBound( $avArray ) - 1

$avArray[$I] = Int( Random( 1, 2 ) )

$total = $total + $avArray[$I]


_ArrayDisplay( $avArray, "_ArrayToString() Test" )

MsgBox( 4096, "Test", $total)


Edited by DigitalLocksmith

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.