CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Do Until

  1. #1
    Join Date
    Aug 1999
    Location
    India,Tamilnadu,chennai
    Posts
    1

    Do Until

    Need a Solution for this.

    Question is

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


  2. #2
    Join Date
    Aug 1999
    Location
    TN, USA
    Posts
    4

    Re: Do Until

    Either use Access or use a dat file. e-mail me if you want [email protected]



    Genie Applebury

  3. #3
    Join Date
    Aug 1999
    Posts
    10

    Re: Do Until

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured