## Operator

Operator is that which can operate something. For example we want to add two number 10 and 20. We can do this putting ‘+’ between 10 and 20. Here ‘+’ operates 10 and 20 thus produces sum of 10 and 20. So, + is a operator and 10,20 are the operand. If an operator operates only one operand, it will call **unar** **y** operator.But if it operates tw0 operands, it will call **binary** operator. Suppose you write ‘-9’,here ‘-‘ is a **unary** operator and if you write ‘9-5’, here ‘-‘ will **binary** operator. ‘>’ and ‘<‘ are always binary operator. In C programming language some operators have different meaning, you must know this meaning. For in mathematics ‘=’ is called equal but in C program ‘=’ means assignment operator and ‘==’ means equal operator. There is another difference to represents the following line in C programming:

**2<x<3**

In mathematics the above line means the value of ‘x’ is greater than 2 and less than 3. But in C programming it should be written as follows:

x<2 && x<3

Here && means AND so the above line can be read as x>2 AND x<3.

Some operators in C program:

Operator | Explanation | Example | ||
---|---|---|---|---|

+ | Add two value |
## OUTPUTInput two value of a and b:10 20 |
||

– | Subtract two value |
## OUTPUTInput two value of a and b:40 10 |
||

* | Multiply two or more value. |
## OUTPUTEnter two value of a and b:10 3 |
||

/ | Divide one number by another number. |
## OUTPUTEnter two value of a and b:60 20 |
||

== | It means equal. | x=10 and y=10, then x==y. | ||

!= | It means not equal. | x=10 and y=15 then x!=y. | ||

> | Greater than | x=15 and y=10 than x>y. | ||

< | Less than | x=10 and y=15 then x<y. | ||

<= | Less than or equal | x=10 and y=5 then x<=y is true. | ||

>= | Greater than or equal | x=10 and y=10 then x>=y is true | ||

% | It is called modulus operator. It is used to find the reminder of a division result. | Divide 12 by 5. Here the remainder is : 2. In C program you can find this reminder as follows:12%5
## OUTPUT1 |
||

= | It is called assignment operator.It is used to assign a value in a variable. |
## OUTPUTValue of a= 10 |
||

++ | It is called increment operator. It is used to increase variable value by one | Suppose x=10 then x++ will increase the value of x by 1 and new value will be 11 and will be assigned to x. x++ is also equivalent to x=x+1
## OUTPUT11 |
||

— — | It is called decrement operator. It is used to decrease variable value by one | Suppose x=10 then x– –will decrease the value of x by 1 and new value will be 9 and will be assigned to x.x– – is also equivalent to x=x–1
## OUTPUT9 |

Next Previous