view src/ploki/examples/fac.pk @ 7638:25b838ae35f6

<boily> le/rn wat/\xe1\x8a\xa2\xe1\x89\xb5\xe1\x8b\xae\xe1\x8c\xb5\xe1\x8b\xab \xe1\x8b\x8d\xe1\x88\xb5\xe1\x8c\xa5 \xe1\x8b\xa8\xe1\x88\x9a\xe1\x88\xb0\xe1\x88\xab \xe1\x8b\xa8\xe1\x88\x9d\xe1\x8c\x8d\xe1\x89\xa5 \xe1\x8a\xa0\xe1\x8b\xad\xe1\x8a\x90\xe1\x89\xb5 \xe1\x88\xb2\xe1\x88\x86\xe1\x8a\x95\xe1\x8d\xa3 \xe1\x8b\xa8\xe1\x88\x9a\xe1\x88\xb0\xe1\x88\xab\xe1\x8b\x8d\xe1\x88\x9d \xe1\x8a\xa8\xe1\x8c\xa4\xe1\x8d\x8d \xe1\x8a\x90\xe1\x8b\x8d\xe1\x8d\xa2
author HackBot
date Sun, 01 May 2016 22:44:03 +0000
parents ac0403686959
children
line wrap: on
line source

"calculate the faculty of [1..8]: "ß{
REM faculty program in false and ploki
REM Lukas Mai, 11.09.2003
REM} [$1=$[\%1\]?~[$1-f;!*]?]f: ^'0-$$0>~\8>|$ {
LET n @LEGS(\EING)
REM}
"result: "ß{
IF n < 1 | (n > 8)
  REM} ~[\f;!.]?[
  "illegal input"ß{
ELSE
  LET f 1
  FOR loop IF n > 0
    LET f f * n
    LET n n - 1
    NEXT loop
  FI
  WUNT f
FI
REM} ]?"
"