Department numbers: Difference between revisions
Content deleted Content added
Not a robot (talk | contribs) Add VTL-2 |
→{{header|TypeScript}}: Added. |
||
Line 4,161:
6 5 1
</pre>
== {{header|TypeScript}} ==
{{trans|Sinclair ZX81 BASIC}}
<lang javascript>
// Department numbers
console.log(`POLICE SANITATION FIRE`);
let f: number;
for (var p = 2; p <= 7; p += 2) {
for (var s = 1; s <= 7; s++) {
if (s != p) {
f = (12 - p) - s;
if ((f > 0) && (f <= 7) && (f != s) && (f != p))
console.log(` ${p} ${s} ${f}`);
}
}
}
</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
</pre>
|