author | Christian Urban <urbanc@in.tum.de> |
Sun, 27 Oct 2019 13:32:15 +0000 | |
changeset 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 |
} |