author | Christian Urban <christian.urban@kcl.ac.uk> |
Sun, 15 Nov 2020 00:33:16 +0000 | |
changeset 804 | 387240957c3d |
parent 750 | e93a9e74ca8e |
permissions | -rw-r--r-- |
750 | 1 |
// prints out prime numbers from 2 to 100 |
674 | 2 |
|
3 |
end := 100; |
|
4 |
n := 2; |
|
5 |
while (n < end) do { |
|
6 |
f := 2; |
|
7 |
tmp := 0; |
|
8 |
while ((f < n / 2 + 1) && (tmp == 0)) do { |
|
9 |
if ((n / f) * f == n) then { tmp := 1 } else { skip }; |
|
10 |
f := f + 1 |
|
11 |
}; |
|
12 |
if (tmp == 0) then { write(n) } else { skip }; |
|
13 |
n := n + 1 |
|
14 |
} |