All challenges
easymath 10 XP per passing test

Prime Number Check

Problem

Given a number, check if it's a prime number. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few prime numbers are 2, 3, 5, 7, 11, and 13. Write a program that reads a number from STDIN and prints 'true' if it's a prime number, 'false' otherwise. The input will be a single line containing a number. The output should be 'true' or 'false' on a single line, with no extra text or whitespace.
(run your code to see output)
Advertisement
Sponsored