pocketlang/test/examples/prime.pk
2021-05-14 15:14:39 +05:30

16 lines
241 B
Plaintext

def is_prime(n)
if n < 2 then return false end
for i in 2..n
if n % i == 0 then return false end
end
return true
end
def print_all_primes(n)
for i in 0..n
if is_prime(i) then print(i) end
end
end
print_all_primes(10)