Function for checking a prime number
Go
Easy
functions
Task «Function for checking a prime number»
Write a function isPrime(n int) bool that determines whether the given integer n is prime. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The function should return true if the number is prime, and false otherwise. In the main program, read one integer from standard input and output the result of the function.
Input Format
One integer n (0 ≤ n ≤ 10^6).
Output Format
true if the number is prime, otherwise false.
Examples
Example 1
INPUT
2
OUTPUT
true
Example 2
INPUT
4
OUTPUT
false
main.go