Smallest divisor of n

Given an integer n, we are interested in the smallest divisor of n (other than 1).
The program input contains a single number n.
The program should print the smallest divisor of n.
Input
Output
8
2
7
7
385
5
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue