Apr-26-2019, 09:44 AM
(This post was last modified: Apr-26-2019, 09:47 AM by akbarasghar.)
hi
I was trying to print prime numbers from 3 to 100
this is my code
I'm not looking for a "better code" or "how to make prime numbers" I just want to know why does it show numbers like 27 and 35 which are not prime
I was trying to print prime numbers from 3 to 100
this is my code
i=3 n=2 while i<100 : while n < i : if i%n == 0: i+=1 else: n+=1 if n==i: print(i) i+=1 n=2 else: n=2 i+=1the result is :3,5,7,11,13,17,19,23,27,29,31,35,37,41,...
I'm not looking for a "better code" or "how to make prime numbers" I just want to know why does it show numbers like 27 and 35 which are not prime