Skip to content
Sign upLog in
← Back to Community
Prime Numbers in Python
Profile icon
ITTest

hey guys fro MAD 319
def isPrimeNumber(i):
factors = 0 ; j = 1
while j <= i :
if i % j == 0 :
factors+=1
j+=1
return (factors == 2);
print(isPrimeNumber(99))

counter = 0;
for i in range(1,101):
if isPrimeNumber(i):
counter+=1
print(counter, " : " , i)#;

Voters
Profile icon
NathanChenliu
Profile icon
ITTest