Department numbers: Difference between revisions
Content added Content deleted
(→{{header|Minimal BASIC}}: Added) |
(→{{header|XPL0}}: Added) |
||
Line 4,034: | Line 4,034: | ||
14 valid combinations |
14 valid combinations |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
{{trans|Sinclair ZX81 BASIC}} |
|||
{{works with|EXPL-32}} |
|||
<lang xpl0> |
|||
\Department numbers |
|||
code CrLf=9, IntIn=10, IntOut=11, Text=12; |
|||
integer P, S, F; |
|||
begin |
|||
Text(0, "POLICE SANITATION FIRE"); |
|||
CrLf(0); |
|||
P:= 2; |
|||
while P <= 7 do |
|||
begin |
|||
for S:= 1, 7 do |
|||
if S # P then |
|||
begin |
|||
F:= (12 - P) - S; |
|||
if (F > 0) & (F <= 7) & (F # S) & (F # P) then |
|||
begin |
|||
Text(0, " "); IntOut(0, P); |
|||
Text(0, " "); IntOut(0, S); |
|||
Text(0, " "); IntOut(0, F); |
|||
CrLf(0) |
|||
end |
|||
end; |
|||
P:= P + 2 |
|||
end; |
|||
end |
|||
</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> |
</pre> |
||