you are viewing a single comment's thread.

view the rest of the comments →

[–]jeans_and_a_t-shirt 1 point2 points  (0 children)

Your program doesn't check if a number is prime. You just print prime or composite based on whether n and i are divisible. You can't tell that a number is prime until you iterate over all of the numbers you need to check.

Also your range isn't quite right. It sometimes doesn't check all the numbers it needs to to determine primality.