Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating a sum of an array

Status
Not open for further replies.

RussOSU

Technical User
Apr 16, 2001
93
US
I am trying to calculate the sum of an array. This would be so I could show the total # of points someone has collected throughout the year.

If my array is

aintStudentgrade1(0) = 90
aintStudentgrade1(1) = 100
aintStudentgrade1(2) = 85

how do I represent that in a sumation?

For intCounter 0 to 2
sum(aintStudentgrade1(intCounter))

This isn't right but I hope you can get the idea of what I am thinking.
 

intGradeSum = 0
intLowerB = lbound(aintStudentgrade1)
intUpperB = ubound(aintStudentgrade1)

for a = intLowerB to intUpperB
intGradeSum = intGradeSum + aintStudentgrade1(a)
next a


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top