Page 82 - 2619_PlusGPT V2.1_C-8
P. 82

The arithmetic operators are defined in the following table:

                   Operator Name               Description                                       Example      Output
                                                                                              (x=7 and y=3)
                       +      Addition         Adds values on either side of the operator.         x + y         10
                       –      Subtraction      Subtracts the right-hand operand from the           x – y          4
                                               left-hand operand.
                       *      Multiplication   Multiplies values on either side of the operator.   x * y         21
                       /      Division         Divides left-hand operand by right-hand             x / y          3
                                               operand.
                       %      Modulus          Divides left-hand operand by right-hand             x % y          1
                                               operand and returns the remainder.
                      **      Exponentiation Performs exponential (power) calculation on           x ** y       343
                                               operands.
                       //     Floor or Integer  Divides and cuts the fractional part from the      x // y         2
                              division         result.


                   Program 1: To perform all the arithmetic operations.



























                  The result of the above program is:

























                  80    Premium Edition-VIII
   77   78   79   80   81   82   83   84   85   86   87