Page 121 - PortGPT_V2.1_C6_Flipbook
P. 121

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  119
   116   117   118   119   120   121   122   123   124   125   126