Nearest Prime from Hackerearth

Question:- https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-2/practice-problems/algorithm/nearest-prime-a828361b/submissions/

Code:-https://ide.codingblocks.com/s/382962

I don’t understand where I am going wrong