home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 13 / CD_ASCQ_13_0494.iso / maj / 419 / mavgi.bas < prev    next >
BASIC Source File  |  1994-03-13  |  811b  |  25 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1994  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. SUB MeanAverageI (Array%(), First%, Last%, Average%, ErrCode%)
  8.    ErrCode% = 0
  9.    IF First% = 0 THEN
  10.       F% = LBOUND(Array%, 1)
  11.    ELSE
  12.       F% = First%
  13.    END IF
  14.    IF Last% = 0 OR Last% < First% THEN
  15.       L% = UBOUND(Array%, 1)
  16.    ELSE
  17.       L% = Last%
  18.    END IF
  19.    FOR Tmp% = F% TO L%
  20.       Total& = Total& + Array%(Tmp%)
  21.       Count% = Count% + 1
  22.    NEXT
  23.    Average% = Total& \ Count%
  24. END SUB
  25.