McNuggets problem: Difference between revisions
Add ABC
(→{{header|RPL}}: direct Go traduction + tweak) |
Not a robot (talk | contribs) (Add ABC) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 77:
{{out}}
<pre>43</pre>
=={{header|ABC}}==
<syntaxhighlight lang="abc">PUT {1..100} IN non.nuggets
PUT 0 IN a
WHILE a <= 100:
PUT a IN b
WHILE b <= 100:
PUT b IN c
WHILE c <= 100:
IF c in non.nuggets:
REMOVE c FROM non.nuggets
PUT c+20 IN c
PUT b+9 IN b
PUT a+6 IN a
WRITE "Maximum non-McNuggets number:", max non.nuggets/</syntaxhighlight>
{{out}}
<pre>Maximum non-McNuggets number: 43</pre>
=={{header|Action!}}==
<syntaxhighlight lang="action!">PROC Main()
Line 627 ⟶ 645:
{{out}}
<pre>Maximum non-McNuggets number is: 43</pre>
==={{header|True BASIC}}===
<syntaxhighlight lang="qbasic">OPTION BASE 0
DIM nuggets(100)
FOR n = 0 TO 100
LET nuggets(n) = 0
NEXT n
FOR six = 0 TO 100/6
FOR nine = 0 TO 100/9
FOR twenty = 0 TO 100/20
LET n = six*6 + nine*9 + twenty*20
IF n <= 100 THEN LET nuggets(n) = 1
NEXT twenty
NEXT nine
NEXT six
FOR n = 100 TO 1 STEP -1
IF nuggets(n) <> 1 THEN
PRINT "Maximum non-McNuggets number is: "; n
EXIT FOR
END IF
NEXT n
END</syntaxhighlight>
==={{header|XBasic}}===
Line 2,776 ⟶ 2,818:
=={{header|Wren}}==
{{trans|Go}}
<syntaxhighlight lang="
var sv = List.filled(limit+1, false)
var s = 0
|