- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment Operators

**Arithmetic Operators**

Arithmetic Operators Explains that Let suppose X=10 , Y=5

Operator | Description | Example |
---|---|---|

+ | Adds two operands | X + Y = 15 |

- | Subtracts second operand from the first | X - Y = 5 |

* | Multiplies both operands | X * Y = 50 |

/ | Divides numerator by denominator result should be the quotient | X / Y = 2 |

% | Modulus Operator and remainder of after an integer division | Y % X = 0 |

++ | Increment operator increases integer value by one | X++ = 11 |

-- | Decrements operator decreases integer value by one | Y-- = 9 |

**Relational Operator:**

Relational Operators Explains that Let suppose X=10 , Y=5

Operator | Description | Example |
---|---|---|

== | It will check the values of two operands are equal or not, If yes then condition becomes true. | (X == X) False. |

!= | It Will check the values of two operands are equal or not, if values are not equal, Then the condition becomes true. | (X != Y) True. |

> | It Will check the value of left operand is greater than the value of right operand, If yes then condition becomes true. | (X > Y) True. |

< | It will checks the value of left operand is less than the value of right operand, If yes then condition becomes true. | (X < Y) False. |

>= | It will checks the value of left operand is greater than or equal to the value of right operand, If yes then condition becomes true. | (X >= Y) True. |

<= | It will check the value of left operand is less than or equal to the value of right operand, If yes then condition becomes true. | (X <= Y) False. |

**Logical Operator:**

Logical Operators Explains that Let suppose X=true, Y=false

Operator | Description | Example |
---|---|---|

&& | Logical AND operator. If both the operands are true then condition becomes true else false. | (X && Y) false. |

|| | Logical OR Operator. If any of the two operands is true then condition becomes true. | (X || Y) true. |

! | Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. | !(X && Y) true. |

**Assignment Operator:**

Assignment Operator explains that X, Y and Z

Operator | Description | Example |
---|---|---|

= | Simple assignment operator, Assigns values from right side operands to left side operand | Z = X + Y assigns value of X + Y into Z |

+= | Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand | Z += X is equivalent to Z = Z + X |

-= | Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand | Z -= X is equivalent to Z = Z - X |

*= | Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand | Z *= X is equivalent to Z = Z * X |

/= | Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand | Z /= X is equivalent to Z = Z / X |

%= | Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand | Z %= X is equivalent to Z = Z % X |

<<= | Left shift AND assignment operator | Z <<= 2 is same as Z = Z << 2 |

>>= | Right shift AND assignment operator | Z >>= 2 is same as Z = Z >> 2 |

&= | Bitwise AND assignment operator | Z &= 2 is same as Z = Z & 2 |

^= | bitwise exclusive OR and assignment operator | Z ^= 2 is same as Z = Z ^ 2 |

|= | bitwise inclusive OR and assignment operator | Z |= 2 is same as Z = Z| 2 |