Page 88 - Dig_CodeAI_V2.1_Class_7
P. 88

Program: To perform the arithmetic operations.




























                  On running the above program, you will get the following output:



















                  Assignment Operators

                  The assignment operators are used to assign the value of the right expression to the left operand.
                  The assignment operators are described in the following table:

                   Operator    Name              Description                                              Example

                       =       Assignment        It assigns the value of operand on the right side to the    x = 5
                                                 left side operand.
                       +=      Addition          It adds right operand to the left operand and assigns       x += 3
                               assignment        the result to left operand. x+=3 is equivalent to x=x+3.

                       –=      Subtraction       It subtracts right operand from the left operand and        x –= 3
                               assignment        assigns the result to left operand. x–=3 is equivalent to
                                                 x=x–3.

                       *=      Multiplication    It multiplies right operand with the left operand and       x *= 3
                               assignment        assigns the result to left operand. x*=3 is equivalent to
                                                 x=x*3.



                       86    DigiCode AI (Ver. 2.1)-VII
   83   84   85   86   87   88   89   90   91   92   93