blob: ae6545393ede405c1ae8c2b3a1621bc19a8fd235 (
plain) (
blame)
1
2
3
4
5
6
7
|
namespace;
include rt;
fn fact(n) { if (n < 2) return 1; return n * fact(n - 1); }
// prints in binary, like the old asm example
void bin(n) { if (n > 1) bin(n >> 1); rt.put_c('0' + (n & 1)); return; }
void main() { bin(fact(10)); rt.put_c(10); rt.put_n(fact(10)); rt.put_c(10); return; }
|