Factorions: Difference between revisions
m
Applesoft BASIC moved to the BASIC section.
(Add lang example) |
m (Applesoft BASIC moved to the BASIC section.) |
||
Line 169:
The factorions for base 12 are:
1 2</pre>
=={{header|Applesoft BASIC}}==▼
<syntaxhighlight lang="basic">100 DIM FACT(12)▼
110 FACT(0) = 1▼
120 FOR N = 1 TO 11▼
130 FACT(N) = FACT(N - 1) * N▼
140 NEXT ▼
200 FOR B = 9 TO 12▼
210 PRINT "THE FACTORIONS ";▼
215 PRINT "FOR BASE "B" ARE:"▼
220 FOR I = 1 TO 1499999▼
230 SUM = 0▼
240 FOR J = I TO 0 STEP 0▼
245 M = INT (J / B)▼
250 D = J - M * B▼
260 SUM = SUM + FACT(D)▼
270 J = M▼
280 NEXT J▼
290 IF SU = I THEN PRINT I" ";▼
300 NEXT I▼
310 PRINT : PRINT ▼
320 NEXT B</syntaxhighlight>▼
=={{header|Arturo}}==
Line 284 ⟶ 262:
base 12 factorions: 1 2
</pre>
=={{header|BASIC}}==
▲==={{header|Applesoft BASIC}}===
▲<syntaxhighlight lang="basic">100 DIM FACT(12)
▲110 FACT(0) = 1
▲120 FOR N = 1 TO 11
▲130 FACT(N) = FACT(N - 1) * N
▲140 NEXT
▲200 FOR B = 9 TO 12
▲210 PRINT "THE FACTORIONS ";
▲215 PRINT "FOR BASE "B" ARE:"
▲220 FOR I = 1 TO 1499999
▲230 SUM = 0
▲240 FOR J = I TO 0 STEP 0
▲245 M = INT (J / B)
▲250 D = J - M * B
▲260 SUM = SUM + FACT(D)
▲270 J = M
▲280 NEXT J
▲290 IF SU = I THEN PRINT I" ";
▲300 NEXT I
▲310 PRINT : PRINT
▲320 NEXT B</syntaxhighlight>
=={{header|C}}==
|