Function for checking prime numbers
Rust
Easy
functions
Task «Function for checking prime numbers»
Write a function is_prime that takes a non-negative integer n and returns true if it is prime, and false otherwise. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The function must correctly handle numbers from 0 to 1000. In main, read a number from standard input, call the function, and output the result as the string "true" or "false".
Input Format
Integer n (0 ≤ n ≤ 1000).
Output Format
String "true" or "false".
Examples
Example 1
INPUT
2
OUTPUT
true
Example 2
INPUT
7
OUTPUT
true
main.rs