Anonymous user
McNuggets problem: Difference between revisions
m
→{{header|REXX}}: corrected misspellings.
(→{{header|REXX}}: added the REXX computer programming language.) |
m (→{{header|REXX}}: corrected misspellings.) |
||
Line 53:
=={{header|REXX}}==
<lang rexx>/*REXX pgm solves the
parse arg y /*obtain optional arguments from the CL*/
if y='' | y="," then y= 6 9 20 /*Not specified? Then use the defaults*/
say 'The number of McNuggets in the serving sizes of: ' space(y)
$=
#= 0 /*the Y list must be in
z=.
do j=1 for words(y); _= word(y, j) /*examine Y list for dups, neg,
if _==1 then signal done /*Value ≡ 1? Then all values
if _<1 then iterate /*ignore zero and negative # of nuggets*/
if wordpos(_, $)\==0 then iterate /*search for duplicate values. */
Line 91:
end /*z*/
say
done: if z==. then say 'The largest
else say 'The largest
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 100:
do until y==0; parse value x//y y with y x; end
end; return x<lang>
{{out|output|text= when using the default inputs:}}
<pre>
The number of McNuggets in the serving sizes of: 6 9 20
The largest McNuggets number is: 43
</pre>
|