Department numbers: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
(→{{header|Modula-2}}: Added MiniScript) |
||
Line 2,972: | Line 2,972: | ||
<pre>{{2, 3, 7}, {2, 4, 6}, {2, 6, 4}, {2, 7, 3}, {4, 1, 7}, {4, 2, 6}, {4, 3, 5}, {4, 5, 3}, |
<pre>{{2, 3, 7}, {2, 4, 6}, {2, 6, 4}, {2, 7, 3}, {4, 1, 7}, {4, 2, 6}, {4, 3, 5}, {4, 5, 3}, |
||
{4, 6, 2}, {4, 7, 1}, {6, 1, 5}, {6, 2, 4}, {6, 4, 2}, {6, 5, 1}}</pre> |
{4, 6, 2}, {4, 7, 1}, {6, 1, 5}, {6, 2, 4}, {6, 4, 2}, {6, 5, 1}}</pre> |
||
=={{header|MiniScript}}== |
|||
{{trans|Kotlin}} |
|||
<syntaxhighlight lang="miniscript">print "Police Sanitation Fire" |
|||
print "------ ---------- ----" |
|||
count = 0 |
|||
for h in range(1, 3) |
|||
i = h * 2 |
|||
for j in range(1, 7) |
|||
if j != i then |
|||
for k in range(1, 7) |
|||
if k != i and k != j and i + j + k == 12 then |
|||
print " " + i + " " + j + " " + k |
|||
count += 1 |
|||
end if |
|||
end for |
|||
end if |
|||
end for |
|||
end for |
|||
print char(10) + count + " valid combinations"</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Police Sanitation Fire |
|||
------ ---------- ---- |
|||
2 3 7 |
|||
2 4 6 |
|||
2 6 4 |
|||
2 7 3 |
|||
4 1 7 |
|||
4 2 6 |
|||
4 3 5 |
|||
4 5 3 |
|||
4 6 2 |
|||
4 7 1 |
|||
6 1 5 |
|||
6 2 4 |
|||
6 4 2 |
|||
6 5 1 |
|||
14 valid combinations |
|||
</pre> |
|||
=={{header|Modula-2}}== |
=={{header|Modula-2}}== |