There are five arithmetic operators in C. They are
Operators Purposes
+ Addition
- Subtraction
* Multiplication
/ Division
% remainder
after integer division (also called modulus operator)
There is no exponential operator in C. However, there
is a library function (pow) to carry out exponential.
The operands acted upon by
arithmetic operators must represent numeric values. The remainder operator (%)
requires that both operands be integers and the second operand be non zero.
Similarly, the division operator (/) requires that the second operand be
non-zero. Division of one integer quantity by another is referred to as integer
division. The operation always result in a truncated quotient (i.e. the decimal
portion of the quotient will be dropped). On the other hand, if a division
operation is carried out with two floating-point numbers, or one floating point
numbers and other integer, the result will be a floating point.
Comments
Post a Comment