If statement executing even when conditionals are false.

The logic of the < > didn't really need to be fixed - no difference.

The semicolon, however, was the problem. In C, an if statement is

if ( )

the statement can be an expression with a trailing semicolon, the "empty" statement (a semicolon on its own), or some braces surrounding a { }, or a few other things. Your 'if' was correct, but the condition was controlling the execution of a single empty statement.