Bell numbers: Difference between revisions

→‎{{header|ASIC}}: Added a solution.
(→‎{{header|XPL0}}: Added a solution.)
(→‎{{header|ASIC}}: Added a solution.)
Line 484:
590 NEXT J,I
600 RETURN</syntaxhighlight>
 
==={{header|ASIC}}===
{{trans|Delphi}}
Compile with the ''Extended math'' option.
<syntaxhighlight lang="basic">
REM Bell numbers
DIM A&(13)
FOR I = 0 TO 13
A&(I) = 0
NEXT I
N = 0
A&(0) = 1
GOSUB DisplayRow:
WHILE N <= 13
A&(N) = A&(0)
J = N
WHILE J >= 1
JM1 = J - 1
A&(JM1) = A&(JM1) + A&(J)
J = J - 1
WEND
N = N + 1
GOSUB DisplayRow:
WEND
END
 
DisplayRow:
PRINT "B(";
SN$ = STR$(N)
SN$ = RIGHT$(SN$, 2)
PRINT SN$;
PRINT ") =";
PRINT A&(0)
RETURN
</syntaxhighlight>
{{out}}
<pre>
B( 0) = 1
B( 1) = 1
B( 2) = 2
B( 3) = 5
B( 4) = 15
B( 5) = 52
B( 6) = 203
B( 7) = 877
B( 8) = 4140
B( 9) = 21147
B(10) = 115975
B(11) = 678570
B(12) = 4213597
B(13) = 27644437
B(14) = 190899322
</pre>
 
==={{header|FreeBASIC}}===
511

edits