diff options
| author | Franklin Wei <git@fwei.tk> | 2015-11-21 17:35:20 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-11-21 17:35:20 -0500 |
| commit | df27295ce6e79f409f677da884d32bd9675733be (patch) | |
| tree | ac8fd376fe07383ae28dddb3ab501e03eb7f08ab /examples/primecount.ds | |
| parent | b9338d00533706fe7aa7cda4b57af8777b5e1298 (diff) | |
| download | ducky-df27295ce6e79f409f677da884d32bd9675733be.zip ducky-df27295ce6e79f409f677da884d32bd9675733be.tar.gz ducky-df27295ce6e79f409f677da884d32bd9675733be.tar.bz2 ducky-df27295ce6e79f409f677da884d32bd9675733be.tar.xz | |
fix c transcompiler, prettify output
Diffstat (limited to 'examples/primecount.ds')
| -rwxr-xr-x | examples/primecount.ds | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/primecount.ds b/examples/primecount.ds new file mode 100755 index 0000000..8bb4fc8 --- /dev/null +++ b/examples/primecount.ds @@ -0,0 +1,22 @@ +#!/bin/ducky +LOG Counting... +NEWLINE +LET primes=0 +LET MAX=100000 +LET n = 2 +LBL test_number + LET iter = 2 + LET stop = sqrt n + LBL test_loop + IF !(n % iter); GOTO composite + INC iter + IF iter < stop; GOTO test_loop + INC primes + LBL composite + INC n + IF n < MAX; GOTO test_number +LOG Number of primes below +LOGVAR MAX +LOG : +LOGVAR primes +NEWLINE |