This kinda functions are called signum functions.
Looking at the question
Put n=2(even)
Put n=3(odd)
Hence done .
You can take any input for your answer.
1.6m questions
2.0m answers