Click to See Complete Forum and Search --> : Do Until


M. Raja
August 20th, 1999, 08:24 AM
Need a Solution for this.

Question is

Write a code segment to input and finding the sum and average of n numbers.

Genie Apples
August 20th, 1999, 06:18 PM
Either use Access or use a dat file. e-mail me if you want tinytimer@hotmail.com



Genie Applebury

PedroD
August 25th, 1999, 02:51 AM
I hope this code snippet shows you how a Sum can be done:


''/
' This function recieves an array of Long's and summarizes them.
' It returns the sum of the numbers in the array, or zero (0) if
' The parameter is not an array of Long numnbers.
'/
public Function Summarize(byref MyNumberArray as Variant) as long
on error resume next

Dim result as Long ' Holds the sum
Dim l as Long ' Counter variable

result = 0
If VarName(MyNumberArray) = "Long()" then ' Certify that this is an array
for l = 0 to UBound(MyNumberArray)
result = result + MyNumberArray(l)
next
End If
Summarize = result
End Function




P.Dias
Oslo, Norway