Why doesn't this if statement work (C)?

Associate
Joined
8 Nov 2005
Posts
56
Code:
if (inputAnswer != 'A' || inputAnswer != 'B' || inputAnswer != 'C' || inputAnswer != 'D') { printf("error"); }

Even if 'inputAnswer' equals A, B, C or D it still displays 'error', i can't figure out why it's doing this. If i take out the ||(or) and just have the one inputAnswer !='A' then it works, but not when i add more than one.

Anyone able to shed some light on this please?

Thank you for reading! :)
 
Thank you both for your help. Changed them to 'ands' and it does the job i want it to do. :)

Edit: I should have known this, but it seemed i was getting myself confused
 
Back
Top Bottom