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; if @.j<=@.k then/*set iterate K /*In order?to the next item in @ Goodarray.*/
parse valueif @.j <=@.k 0 then iterate with @.k @.j ok /*swapIs 2 elements;@.J flagin asnumerical ¬doneorder? Good. */
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*/ /* [↑] traipse thru array, find min,max*/
call bSort # /*use a bubble sort (easiest to code). */
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=&nbsp; when using the default input of: &nbsp; &nbsp; <tt> 15 6 42 41 7 36 49 40 39 47 43 </tt>}}