author | Christian Urban <christian.urban@kcl.ac.uk> |
Sat, 04 Jul 2020 16:58:12 +0100 | |
changeset 732 | c7bdd7eac4cb |
parent 674 | e0a41a1f24cf |
permissions | -rw-r--r-- |
674 | 1 |
// prints out prime numbers from |
2 |
// 2 to 100 (end) |
|
3 |
||
4 |
end := 100; |
|
5 |
n := 2; |
|
6 |
while (n < end) do { |
|
7 |
f := 2; |
|
8 |
tmp := 0; |
|
9 |
while ((f < n / 2 + 1) && (tmp == 0)) do { |
|
10 |
if ((n / f) * f == n) then { tmp := 1 } else { skip }; |
|
11 |
f := f + 1 |
|
12 |
}; |
|
13 |
if (tmp == 0) then { write(n) } else { skip }; |
|
14 |
n := n + 1 |
|
15 |
} |