summaryrefslogblamecommitdiff
path: root/src/user/app/kbasic/prime.bas
blob: bbe4bd0ffa0c7abe0d8acd39655a63cda4bb3b09 (plain) (tree)



















                                        
10 i = 2
20 gosub 100
30 if p = 1 then print i;
40 i = i + 1
50 if i > 1000 then goto 300
60 goto 20

100 p = 1
110 d = 2
120 if d * d > i then return
130 if i % d = 0 then goto 200
140 d = d + 1
150 goto 120
200 p = 0
210 return

300 print
310 print "That's all primes for today!"
320 end