Not sure why there are 2 cases for 2 and presumably modulo 2 but here goes a version that compiles and hopefully does what you intended it to do.
main = do
line <- getLine
let n = read line
if n == 2
then print("NO")
else if n `mod` 2 == 0
then print("NO")
else print("YES")
This could be written a lot more concisely but I attemped to stay as close as possible to your version.
Takeaways:
- You don't need semicolons in Haskell at all
- You seem to want to redeclare n from a String to an Int. In Haskell you do not mutate variables but create new independent ones instead. Also, if you want to declare variables inside of your function use "let" (only in do blocks), "let" .. "in" or "where"
- digitToInt and % are not the functions you are looking for. Tip: Look for functions by name or signature on hoogle
Hope I could help.