Department numbers: Difference between revisions

no edit summary
No edit summary
Line 3,993:
Police:6, Sanitation:2, Fire:4
Police:6, Sanitation:4, Fire:2</pre>
 
=={{header|Vlang}}==
{{trans|Go}}
<lang go>fn main() {
println("Police Sanitation Fire")
println("------ ---------- ----")
mut count := 0
for i := 2; i < 7; i += 2 {
for j in 1..8 {
if j == i { continue }
for k in 1..8 {
if k == i || k == j { continue }
if i + j + k != 12 { continue }
println(" $i $j $k")
count++
}
}
}
println("\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|Wren}}==
338

edits