Department numbers: Difference between revisions

add fermat, tinybasic, gwbasic
(Add Mercury)
(add fermat, tinybasic, gwbasic)
Line 1,430:
{ 6, 4, 2 }
{ 6, 5, 1 }
</pre>
=={{header|Fermat}}==
<lang fermat>!!'Police Sanitation Fire';
!!'------|----------|----';
for p = 2 to 6 by 2 do
for s = 1 to 7 do
for f = 1 to 7 do
if p+f+s=12 and f<>p and f<>s and s<>p then !!(' ',p,' ',s,' ',f);
fi od od od;</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>
 
Line 1,714 ⟶ 1,740:
 
14 valid combinations</pre>
 
=={{header|GW-BASIC}}==
<lang gwbasic>10 PRINT "Police Sanitation Fire"
20 PRINT "------|----------|----"
30 FOR P = 2 TO 7 STEP 2
40 FOR S = 1 TO 7
50 IF S = P THEN GOTO 100
60 FOR F = 1 TO 7
70 IF S = F OR F = P THEN GOTO 90
80 IF P+S+F = 12 THEN PRINT USING " # # #";P;F;S
90 NEXT F
100 NEXT S
110 NEXT P</lang>
 
=={{header|Haskell}}==
Line 3,774 ⟶ 3,813:
14 valid combinations found.
</pre>
 
=={{header|Tiny BASIC}}==
<lang tinybasic> PRINT "Police Sanitation Fire"
PRINT "------|----------|----"
10 LET P = P + 2
LET S = 0
20 LET S = S + 1
LET F = 0
IF S = P THEN GOTO 20
30 LET F = F + 1
IF S = F THEN GOTO 30
IF F = P THEN GOTO 30
IF P + S + F = 12 THEN PRINT " ",P," ", S," ", F
IF F < 7 THEN GOTO 30
IF S < 7 THEN GOTO 20
IF P < 6 THEN GOTO 10</lang>
 
=={{header|Visual Basic .NET}}==
781

edits