Adding elements of an array
Adding elements of an array
(OP)
I have an array with three elements in it. How do I add these elements and then average them?
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS Contact USThanks. We have received your request and will respond promptly. Come Join Us!Are you a
Computer / IT professional? Join Tek-Tips Forums!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines |
Adding elements of an array
|
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
Register now while it's still free!
Already a member? Close this window and log in.
RE: Adding elements of an array
============================================
Dim a(3) As Integer
Dim i As Integer, j As Integer
a(1) = 75
a(2) = 125
a(3) = 400
For i = 1 To 3
j = j + a(i)
Next i
MsgBox "sum of array A is " & Str(j) & " average is " & Str(j / 3)
============================================