Operators
Operators are symbols that tell the program to perform a specific operation on data.
Arithmetic Operators
Used for mathematical calculations:
+(Addition):5 + 3 = 8-(Subtraction):7 - 4 = 3*(Multiplication):3 * 4 = 12/(Division):12 / 4 = 3%(Modulus - remainder of division):13 % 4 = 1++(Increment):i++increases by 1.--(Decrement):j--decreases by 1.
Comparison Operators
They return a boolean value (true or false):
==(Equality):a == b!=(Inequality):a != b>(Greater than):a > b<(Less than):a < b>=(Greater or equal):a >= b<=(Less or equal):a <= b
Logical Operators
Used to combine boolean expressions:
&&(AND): True if both are true.||(OR): True if at least one is true.!(NOT): Negates the value (changestruetofalseand vice versa).
Assignment Operators
=(Simple assignment):x = 10+=:x += 3is the same asx = x + 3-=:x -= 4*=:x *= 5/=:x /= 2%=:x %= 3