Check Prime Number
Easyjavapythonccppjavascript
Given an integer N, determine whether it is a prime number. A prime number is greater than 1 and has exactly two positive divisors: 1 and itself.
Input Format
A single line containing the integer N.
Output Format
Print 1 if N is prime, otherwise print 0.
Example 1
Input
29
Output
1
Explanation: 29 is divisible only by 1 and 29.
- 1 <= N <= 1000000000000
Submit an attempt to unlock the solution. (Sign in first.)
Related Problems
- Greatest Common DivisorEasy · java, python, c, cpp, javascriptSolve Problem
- Least Common MultipleEasy · java, python, c, cpp, javascriptSolve Problem
- Count Digits and Digit SumEasy · java, python, c, cpp, javascriptSolve Problem