Prime Check
Easy 20 XPMathLoops
Commonly asked at TCS, Infosys, Wipro, Zoho
Read an integer n and print Prime if it is a prime number, otherwise Not Prime. Remember 0 and 1 are not prime.
- Input
- One integer n.
- Output
- Prime or Not Prime.
- Constraints
- 0 ≤ n ≤ 10^9. Your program must finish quickly even for large n.
Sample 1
Input
17
Output
Prime
Sample 2
Input
21
Output
Not Prime
Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.The solution unlocks after 3 submissions.