Arithmetic Operators

All the basic arithmetic operations can be carried out in C. Both unary and binary operations are available in C language. Unary operations operate on a singe operand, therefore the number 5 when operated by unary – will have the value –5.

Operator

Meaning

+

Addition or Unary Plus

Subtraction or Unary Minus

*

Multiplication

/

Division

%

Modulus Operator


Examples of arithmetic operators are
x + y
x - y
-x + y
a * b + c
-a * b   etc.,

here a, b, c, x, y are known as operands..

Integer Arithmetic

x = 27 and y = 5 be 2 integer numbers. Then the integer operation leads to the following results.

x + y = 32
x – y = 22
x * y = 115
x % y = 2
x / y = 5

In integer division the fractional part is truncated.

Floating point arithmetic

Let x = 14.0 and y = 4.0

x + y = 18.0
x – y = 10.0
x * y = 56.0
x / y = 3.50

Back