Anonymous user
Averages/Mode: Difference between revisions
m
→version 1: added/changed comments, indentations, and whitespace.
(task description: Improve formatting and add related tasks box) |
m (→version 1: added/changed comments, indentations, and whitespace.) |
||
Line 2,209:
Returns one mode value.
<lang rexx>/*REXX program finds the mode (most occurring element) of a vector. */
/*
v= 1 8 6 0 1 9 4 6 1 9 9 9 ; say 'vector='v; say 'mode='mode(v); say
v= 1 2 3 4 5 6 7 8 9 11 10 ; say 'vector='v; say 'mode='mode(v); say
v= 8 8 8 2 2 2 ; say 'vector='v; say 'mode='mode(v); say
v='cat kat Cat emu emu Kat' ; say 'vector='v; say 'mode='mode(v); say
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
mode:
if
return ?
'''output'''
<pre>
|