X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=blobdiff_plain;f=samples%2Feratos.mj;fp=samples%2Feratos.mj;h=0000000000000000000000000000000000000000;hp=92d28f88b65b66fbbc814aecfde16e997cf7fc1e;hb=77e39fac55f1a366814d35e75659cb6d88cca4e1;hpb=306587b78e421a7221952e44adde831723748e4c diff --git a/samples/eratos.mj b/samples/eratos.mj deleted file mode 100644 index 92d28f8..0000000 --- a/samples/eratos.mj +++ /dev/null @@ -1,47 +0,0 @@ -program Eratos - - char[] sieve; - int max; // maximum prime to be found - int npp; // numbers per page - -{ - void put(int x) - { - if (npp == 10) { - print(chr(13)); - print(chr(10)); - npp = 0; - } - print(x, 5); - npp++; - } - - void found(int x) - int i; - { - put(x); - i = x; - while (i <= max) { - sieve[i] = 'o'; i = i + x; - } - } - - void main() - int i; - { - read(max); - npp = 0; - sieve = new char[max+1]; - i = 0; - while (i <= max) { - sieve[i] = 'x'; i++; - } - i = 2; - while (i <= max) { - found(i); - while(i <= max && sieve[i] == 'o') - i++; - } - } - -}//test \ No newline at end of file