Gw mau tau Print faktorial: dari BCPL

LET START() = VALOF $(

FOR I = 1 TO 5 DO

WRITEF("%N! = %I4*N", I, FACT(I))

AND FACT(N) = N = 0 -> 1, N * FACT(N - 1)Solusi hitung untuk masalah ratu N:GET "LIBHDR"

LET TRY(LD, ROW, RD) BE

TEST ROW = ALL THEN

COUNT := COUNT + 1

LET POSS = ALL & ~(LD | ROW | RD)

UNTIL POSS = 0 DO $(

LET P = POSS & -POSS

POSS := POSS - P

TRY(LD + P << 1, ROW + P, RD + P >> 1)

LET START() = VALOF $(

FOR I = 1 TO 12 DO $(

WRITEF("%I2-QUEENS PROBLEM HAS %I5 SOLUTIONS*N", I, COUNT)

ALL := 2 * ALL + 1

Martin Richards, BCPL - a tool for compiler writing and systems programming (Proceedings of the Spring Joint Computer Conference, Vol 34, pp 557–566, 1969)

Martin Richards, Arthur Evans, Robert F. Mabee, The BCPL Reference Manual (MAC TR-141, Project MAC, Cambridge, MA, USA, 1974)

Martin Richards, Colin Whitby-Strevens, BCPL, the language and its compiler (Cambridge University Press, 1980)