20 lines
453 B
Text
20 lines
453 B
Text
uses console
|
|
|
|
function isPrime(byval ValorEval as integer) as boolean
|
|
if ValorEval < 2 then return false
|
|
if ValorEval = 2 then return true
|
|
if ValorEval mod 2 = 0 then return false
|
|
dim as integer i, limit = sqr(ValorEval)
|
|
for i = 3 to limit step 2
|
|
if ValorEval mod i = 0 then return false
|
|
next
|
|
return true
|
|
end function
|
|
|
|
int i
|
|
for i = 1 to 99
|
|
if isPrime(i) then print str(i) " ";
|
|
next
|
|
|
|
printl cr "Enter ..."
|
|
waitkey
|