A programming operator is a symbol that represents an action or process. In programming, operator are constructs defined within programming that behaves like functions.
Types of programing operators
- Arithmetic Operator
- Relational Operator
- Logical Operator
- Assignment Operator
- Increment/Decrement Operator
Arithmetic operators are used for performing mathematical calculations. We can write a program for performing calculations like a calculator. Check the table below.
|+||Add two number|
|–||Subtract two number|
|*||Multiply two number|
|/||Divide two number|
These operator provides the relationship between two expressions.
|==||Checks if the value of two operands are equal|
|!=||Checks if the value of two operands are equal or not|
|>||Check if the value is greater|
|<||Checks if the value is smaller|
|>=||Checks if the values is greater or equal|
|<=||Checks if the value is smaller or equal|
This operator checks the logical relationship between two expressions. The conditions provide logical true of false status after checking.
|||||Logical OR, Check if at least one of the operand is true|
|&&||Logical AND, Checks at least one of the operator is false|
|!||Logical NOT, Checks if the operand is false|
An assignment operator is used for assigning the result of an expression to a variable. The symbol of assignment operator is ( = ).
|=||Used to assign a value from right side operand to left side operand|
|+=||Store the sum of both the operands to the left side operand.|
|-=||Store the difference of both the operands to the left side operand.|
|*=||store the multiplicaton of both the operands to the left side operand.|
|/=||Store the division of both the operands to the left side operand.|
|%=||To store the remainder of both the operands to the left side operand.|
Increment and decrement operator is often in performing looping. It either increases the value by one or decreases value by 1.
|+ +||Increment by 1|
|– –||Decrement by 1|