Write a program that asks the user for a number, and then says whether that number is a prime number or not.
A prime number is a positive integer that is divisible only by 1
and itself. The lowest (and only even) prime number is 2
. The first 10 prime numbers are:
2
, 3
, 5
, 7
, 11
, 13
, 17
, 19
, 23
, 29
(PS: the official definition is a bit more specific, making 1
not a prime number)
5
5 is prime
21
21 is not prime
(because 21 is also divisible by 3 and 7)
17
17 is prime
55
55 is not prime
(because 55 is also divisible by 5 and 11)