35. Is It Prime?
Core1000 ms256 MBSolved by 0%
Read an integer and print Yes if it is prime, or No if it is not.
A prime number is greater than 1 and divisible only by 1 and itself. So 1 is not prime, and 2 is.
Constraints - `1 ≤ n ≤ 1000000000`
Input
A single line containing one integer n.
Output
Print exactly one word: Yes or No.
Input7
OutputYes
Noteis a small prime
Input9
OutputNo
Noteis a small composite that catches a loop only checking up to n/2 incorrectly
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution