
Hanna H. answered 05/11/20
PhD in Economist
I imagine that this is the case since in the first case, the computer only has to evaluate if a is less than 901. In the second case, the computer evaluates if a is less than 900 and if a is equal to 900 and then the computer puts an or operator between them. I.e. if (a<900 || a == 900) is equivalent to if (a<=900). Since the former is only requiring the computer to do one comparison, it is faster than the latter.