Department numbers: Difference between revisions
Content added Content deleted
(Added Elixir Solution) |
(Added Wren) |
||
Line 2,933: | Line 2,933: | ||
Police:6, Sanitation:2, Fire:4 |
Police:6, Sanitation:2, Fire:4 |
||
Police:6, Sanitation:4, Fire:2</pre> |
Police:6, Sanitation:4, Fire:2</pre> |
||
=={{header|Wren}}== |
|||
{{trans|Kotlin}} |
|||
<lang ecmascript>System.print("Police Sanitation Fire") |
|||
System.print("------ ---------- ----") |
|||
var count = 0 |
|||
for (h in 1..3) { |
|||
var i = h * 2 |
|||
for (j in 1..7) { |
|||
if (j != i) { |
|||
for (k in 1..7) { |
|||
if ((k != i && k != j) && (i + j + k == 12) ) { |
|||
System.print(" %(i) %(j) %(k)") |
|||
count = count + 1 |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
System.print("\n%(count) valid combinations")</lang> |
|||
{{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|zkl}}== |
=={{header|zkl}}== |