# Array Sum Help

## Recommended Posts

Could someone help me solve this question?

(I´m Portuguese, sorry my bad English....)

Dim \$SumEx[4][4] = [[125, 379, 23, 530], [485, 160, 275, 320], [285, 180, 215, 12]]

_ArrayDisplay(\$SumEx, "Need help")

I have this array wich returns the following:

[0]|125|379|23 |530

[1]|485|160|275|320

[2]|285|180|215|12

[3]|

The question is:

I can i do to place in the line [3] the sum of the numbers in each column?

Thank you in advance.

##### Share on other sites

Could someone help me solve this question?

(I´m Portuguese, sorry my bad English....)

Dim \$SumEx[4][4] = [[125, 379, 23, 530], [485, 160, 275, 320], [285, 180, 215, 12]]

_ArrayDisplay(\$SumEx, "Need help")

I have this array wich returns the following:

[0]|125|379|23 |530

[1]|485|160|275|320

[2]|285|180|215|12

[3]|

The question is:

I can i do to place in the line [3] the sum of the numbers in each column?

Thank you in advance.

```\$SumEx[3][0] = \$SumEx[0][0] + \$SumEx[1][0] + \$SumEx[2][0]
\$SumEx[3][1] = \$SumEx[0][1] + \$SumEx[1][1] + \$SumEx[2][1]
\$SumEx[3][2] = \$SumEx[0][2] + \$SumEx[1][2] + \$SumEx[2][2]```

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

##### Share on other sites

```#include <array.au3>
Dim \$SumEx[4][4] = [[125, 379, 23, 530], [485, 160, 275, 320], [285, 180, 215, 12]]

;Loop through each column
For \$X = 0 to 3
;Loop through each row
For \$Y = 0 to 2
\$SumEx[3][\$X] += \$SumEx[\$Y][\$X]
Next
Next

_ArrayDisplay(\$SumEx, "Need help")```

##### Share on other sites

Thanks, Weaponx

that´s really what i need.

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