Loops/Increment loop index within loop body: Difference between revisions

Loops/Increment loop index within loop body en BASIC256
No edit summary
(Loops/Increment loop index within loop body en BASIC256)
Line 1,234:
42 99,504,028,301,131
</pre>
 
 
=={{header|BASIC256}}==
<lang BASIC256>function isPrime(number)
if (number % 2 = 0) or (number % 3 = 0) then return false
lim = sqr(number)
 
for i = 5 to lim step 2
if number % i = 0 then return false
next i
 
return true
end function
 
i = 42
counter = 0
while counter < 42
if isPrime(i) then
counter += 1
print "n = "; counter, i
i += i - 1
end if
i += 1
end while
end</lang>
 
 
=={{header|C}}==
2,123

edits