As studied earlier, Operators are the symbols, which performs operations on various data items known as operands. For Example: in a a+b
, a
and b
are operands and +
is an operator.
Note:- To perform an operation, operators and operands are combined together forming an expression. For example, to perform an addition operation on operands a and b, the addition(+) operator is combined with the operands a and b forming an expression.
Arithmetic operators are used to perform arithmetic calculations.
They can work on any built-in data type of C except on boolean type.
C provides various arithmetic operators that are,
Operator | Description | Example |
---|---|---|
+ | Adds two operands. | A + B = 30 |
− | Subtracts second operand from the first. | A − B = -10 |
* | Multiplies both operands. | A * B = 200 |
/ | Divides numerator by de-numerator. | B / A = 2 |
% | Modulus Operator and remainder of after an integer division. | B % A = 0 |
++ | Increment operator increases the integer value by one. | A++ = 11 |
-- | Decrement operator decreases the integer value by one. | A-- = 9 |
Addition is: 10