diff -r 08b157566a73 -r a3418ee8c404 cwtests/cw03/primes.while --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cwtests/cw03/primes.while Sun Sep 05 23:51:37 2021 +0100 @@ -0,0 +1,14 @@ +// prints out prime numbers from 2 to 100 + +end := 100; +n := 2; +while (n < end) do { + f := 2; + tmp := 0; + while ((f < n / 2 + 1) && (tmp == 0)) do { + if ((n / f) * f == n) then { tmp := 1 } else { skip }; + f := f + 1 + }; + if (tmp == 0) then { write(n) } else { skip }; + n := n + 1 +} \ No newline at end of file