Anonymous user
Fivenum: Difference between revisions
m
→{{header|REXX}}: split compound statements, added whitespace, aligned comments.
m (added whitespace.) |
m (→{{header|REXX}}: split compound statements, added whitespace, aligned comments.) |
||
Line 1,531:
bSort: procedure expose @.; parse arg n; m=n-1 /*N: the number of @ array elements.*/
do m=m for m by -1 until ok; ok= 1 /*keep sorting the @ array 'til done.*/
do j=1 for m; k= j + 1;
parse value @.j @.k 0 with @.k @.j ok /*swap two elements and flag as ¬done.*/
end /*j*/
end /*m*/; return
Line 1,544 ⟶ 1,545:
if \datatype(@.j, 'N') then return er j "isn't numeric: " @.j
LO= min(LO, @.j); HI= max(HI, @.j)
end /*j*/ /* [↑]
call bSort # /*use a bubble sort
if #//2 then p25= q2 /*calculate the second quartile number.
else p25= q2 - 1 /* " " " " "
return LO med(1, p25) med(1, #) med(q2, #) HI /*return list of 5 numbers.*/</lang>
{{out|output|text= when using the default input of: <tt> 15 6 42 41 7 36 49 40 39 47 43 </tt>}}
|