Department numbers: Difference between revisions
Department numbers in QBasic and XBasic
m (Applesoft BASIC) |
(Department numbers in QBasic and XBasic) |
||
Line 998:
6 4 2
6 5 1</pre>
==={{header|QBasic}}===
<lang qbasic>PRINT "--police-- --sanitation-- --fire--"
FOR police = 2 TO 7 STEP 2
FOR fire = 1 TO 7
IF fire = police THEN GOTO cont
sanitation = 12 - police - fire
IF sanitation = fire OR sanitation = police THEN GOTO cont
IF sanitation >= 1 AND sanitation <= 7 THEN
PRINT USING " # # #"; police; fire; sanitation
END IF
cont:
NEXT fire
NEXT police</lang>
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<lang xbasic>PROGRAM "Depar/num"
DECLARE FUNCTION Entry ()
FUNCTION Entry ()
PRINT "police sanitation fire"
FOR police = 2 TO 7 STEP 2
FOR fire = 1 TO 7
IF fire = police THEN GOTO cont
sanitation = 12 - police - fire
IF sanitation = fire OR sanitation = police THEN GOTO cont
IF sanitation >= 1 AND sanitation <= 7 THEN
PRINT TAB(3); police; TAB(13); fire; TAB(22); sanitation
END IF
cont:
NEXT fire
NEXT police
END FUNCTION
END PROGRAM </lang>
=={{header|C}}==
|