Averages/Arithmetic mean: Difference between revisions
Content deleted Content added
→{{header|ooRexx}}: Accidentally added with the wrong header |
m →{{header|REXX}}: change arg to parse arg. -- ~~~~ |
||
Line 1,687: | Line 1,687: | ||
exit |
exit |
||
/*---------------------AVG subroutine------------------*/ |
/*---------------------AVG subroutine------------------*/ |
||
avg: procedure; arg y |
avg: procedure; parse arg y |
||
s=0 |
s=0 |
||
do j=1 to words(y) |
do j=1 to words(y) |
||
x=word(y,j) |
x=word(y,j) |
||
if \datatype(x,'N') then return '*error* non-numeric' x |
if \datatype(x,'N') then return '*error* non-numeric' x |
||
s=s+x |
s=s+x |
||
end |
end |
||
return s/max(1,words(y))</lang> |
return s/max(1,words(y))</lang> |
||
'''output''' |
'''output''' |