Sign in to follow this  
Followers 0
DigitalLocksmith

Get the average of all values in a one dimensional array

1 post in this topic

#1 ·  Posted (edited)

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

*edit* Nevermind...Figured it out.

CODE
#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]

Next

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

MsgBox( 4096, "Test", $total)

Exit

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  
Followers 0