operators in c

Operators

For doing any arithmetic or logical operation we need operators.


We can broadly categorised operators in three categories

1. Unary operators
2. Binary operators
3. Ternary operators

Binary operators:-

Binary operators need two operands to perform.
Binary operators are different types -

1. Arithmetic operators

There are 5 arithmetic operators

+ , -, *, /, %

Except % (modulus division) all other arithmetic operators can apply on integer number or float number
  • All arithmetic operators can apply on signed number or unsigned number.
  • In modulus division the sign of the result is always the sign of 1st operand

Example :-

10%3=1
-10%3=-1
-10%-3=-1
10%-3=1


Relational operator:-

Relational operator are used to compare two quantities or two number
  • Relational operator can apply on signed number and unsigned number
  • These operator will give the result in the form of 0 and 1
  • Some relational operator are compliment to each other.   

Relational operator          compliment

       <                                           >=

       >                                           <=

      ==                                          !=


If any doubt please ask in comment





Comments