fork download
  1. USING: io kernel math math.parser ;
  2.  
  3. IN: factorial-example
  4.  
  5. : modulo ( n -- n! )
  6. dup
  7. 2
  8. /
  9. 2
  10. *
  11. =
  12. [ 1 ]
  13. [ 0 ]
  14. if ;
  15.  
  16. readln string>number
  17. modulo
  18. number>string print
Success #stdin #stdout 0.19s 163968KB
stdin
3
stdout
1