Page 124 - TechPluse_C7_Flipbook
P. 124

These operators are defined in the following table:

                                                                                                 Example
                   Operator         Name                          Description                    (x=7 and  Output
                                                                                                   y=3)
                       +       Addition           Adds values on either side of the operator.      x + y        10

                       –       Subtraction        Subtracts right hand operand from left           x – y         4
                                                  hand operand.
                       *       Multiplication     Multiplies values on either side of the           x * y       21
                                                  operator.
                       /       Division           Divides left hand operand by right hand           x / y     2.33333

                                                  operand.
                       %       Modulus            Divides left hand operand by right hand          x % y         1
                                                  operand and returns remainder.
                       **      Exponentiation     Performs exponential (power) calculation         x ** y       343
                                                  on operands.
                       //      Floor or Integer  Divides and cuts the fractional part from         x // y        2
                               division           the result.


                  Program 1: To perform all the arithmetic operations.
























                  The result of the above program is:





















               122      Premium Edition-VII
   119   120   121   122   123   124   125   126   127   128   129