Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 137 - 2625 PortGPt V2.1
P. 137

    Operator        Name                         Description                      Example      Output
                                                                                                  (x=7 and y=3)

                          /      Division          Divides left-hand operand by right-hand             x / y       2.33
                                                   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 operators.

                     The result of the above program is:

                                                                                            Introduction to Programming  135

| 132 133 134 135 136 137 138 139 140 141 142 |