prime number function

I am trying to create a function that prints prime numbers up to a certain limit that you type in. For example, if you pass in 100, the function should print the prime numbers between 1 and 100.

A number is prime if it is only evenly divisible by itself and 1, and not evenly divisible by any other number.

So far, this code just prints even numbers as prime and odd as not prime. I feel like I am missing a big chunk of code to check for other conditions but I'm not sure what.

You are viewing a single comment. View All

@DannyIsCoding has a good explanation so check that out. If you want a prime number challenge, check out the Sieve of Eratosthenes (explanation and example)



Thanks! :)