Jump to content

Maximum difference between adjacent elements of list: Difference between revisions

m
→‎{{header|REXX}}: changed whitespace, moved a statement.
m (→‎{{header|REXX}}: added code to align the output element pairs (for the maximum difference).)
m (→‎{{header|REXX}}: changed whitespace, moved a statement.)
Line 436:
@.i= x; w= max(w, length(x) ) /*assign element #; find maximum width.*/
if datatype(x, 'N') then iterate /*Is it numeric? Yes, then continue. */
say '***error*** element #'i " isn't numeric: " x
exit 13
end /*i*/
n= 0 /*N: # sets of (difference) elements.*/
 
if #<2 then do; say '***error*** not enough elements were specified, minimum is two.'
exit 13
end
n= 0 /*N: # sets of (difference) elements.*/
say ' list of elements: ' space($) /*show the list of numbers in list.*/
say ' number of elements: ' # /*show " number " elements " " */
Cookies help us deliver our services. By using our services, you agree to our use of cookies.