Department numbers: Difference between revisions
Content added Content deleted
(Added C# implementation) |
(Added BBC BASIC) |
||
Line 393: | Line 393: | ||
14 7 4 1 |
14 7 4 1 |
||
</pre> |
</pre> |
||
=={{header|BBC BASIC}}== |
|||
{{trans|ALGOL 68}} |
|||
<lang bbcbasic>REM >deptnums |
|||
max_dept_num% = 7 |
|||
dept_sum% = 12 |
|||
PRINT "police sanitation fire" |
|||
FOR police% = 2 TO max_dept_num% STEP 2 |
|||
FOR sanitation% = 1 TO max_dept_num% |
|||
IF sanitation% <> police% THEN |
|||
fire% = (dept_sum% - police%) - sanitation% |
|||
IF fire% > 0 AND fire% <= max_dept_num% AND fire% <> sanitation% AND fire% <> police% THEN PRINT " "; police%; " "; sanitation%; " "; fire% |
|||
ENDIF |
|||
NEXT |
|||
NEXT |
|||
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> |
|||
=={{header|C}}== |
=={{header|C}}== |