you have closed the if bracket too soon, try starting it with,
if(( a!=12.............(a)...(a)..........(a)!=40)
make sure you have closed all your opened brackets, and that whole expression is inside the if( )
I would try wrapping the quotes differently. It should work fine the way you have it, but this makes it easier to read without having to ask yourself if the != operator has a higher precedence than the || operatior. I also removed the dublicate a != 12.
What gab00n is saying is that if a doesn't equal one of the numbers, even if it equals another, the if will return false. If you want to check it doesn't equal any of them replace the ||s with &&s. If that's not what you're trying to do I suggest following furtivefelon's advice.