home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pilot.zip / average.pil next >
Text File  |  1993-08-01  |  208b  |  13 lines

  1. R: Calculate average of given numbers
  2.  
  3. *REPEAT
  4. T: Give a number, 0 quits:
  5. A: #num
  6. C: #sum = #sum + #num
  7. C: #n = #n + 1
  8. J(#num <> 0): *REPEAT
  9.  
  10. C: #n = #n - 1
  11. C: #avg = #sum / #n
  12. T: Average is #avg
  13.