Skip to content
C

Prime Number Checker

Mediumpython

Determine whether a given number is prime, using a for loop with loop-else.

What is a prime number? a whole number greater than 1 that has no divisors other than 1 and itself.

Approach: try dividing n by every number from 2 up to n-1. If none divide evenly, the loop finishes without a break and confirms the number is prime.

Input: One line: a whole number n.

Output: One line: <n> is a prime number or <n> is not a prime number.

Input (stdin)

Output

Run your code to see output here...