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.
9.5m questions
12.2m answers