21 Nov 2019

  • November 21, 2019
  • Amitraj
Operators in C and C++

1.) Arithmetic Operator:-  
   
       The type of operators are use to perform general mathematical functions such as Add, Sub, Multiply or Divide.

-> The Arithmetic Operators in C and C++ include:-

 + (Addition) –    This operator is used to add two operands.

– (Subtraction) – Subtract two operands.

* (Multiplication) – Multiply two operands.

/ (Division)  – Divide two operands and gives the quotient as the answer.

% (Modulus operation) – Find the remains of two integers and gives the remainder after the division.

++ (Increment) – Used to increment an operand.

— (Decrement) – Used to decrement an operand.



**Note:   If the operator presidence by operand then its called, pre-fix & if the operator follow by the operand then its called, post-fix.


*Arithmetic operators are divided in two parts:-

a) Binary operator:-   Binary operators are those type of operators which required two operands.

     Ex:    Operator: + (Add)
               ex:  X+Y


b) Unary operator:-  Unary operators works with single operand.

     Ex:    Operator: ++ (Increment)
               ex:  ++X







Translate

Popular Posts