home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
tolkit45.zip
/
os2tk45
/
samples
/
rexx
/
api
/
rexxcalc
/
program3.cal
< prev
next >
Wrap
Text File
|
1999-05-11
|
964b
|
20 lines
/* Rexx Calculator program 3 key - average of memory registers */
parse arg num /* get the count of memories */
numeric digits CalcPrecision() /* set current precision */
numeric form value CalcForm() /* set current form */
if \datatype(num, 'Whole') /* must be whole number */
then return 'Error' /* return error indicator */
if num < 1 | num >50 /* valid for counter */
then return 'Error' /* return error indicator */
accumulator = 0 /* start at zero */
do i = 1 to num /* loop for given number */
'GET' i 'REGISTER' /* get next register */
accumulator = accumulator + register /* add to total */
end
return accumulator / num /* return the average */