Page 22 - tp_Modula_v2.0
P. 22

Program 1: To perform the arithmetic operations.

                      Program1.py
                   File  Edit  Format   Run   Options  Window    Help

                   #examples of arithmetic operators
                   a=9
                   b=4

                   #addition
                   add = a + b
                   #subtraction
                   sub = a - b
                   #multiplication
                   mul = a * b
                   #division
                   div = a / b
                   #floor division
                   div1 = a // b
                   #modulus
                   mod = a % b
                   #power
                   power = a ** b


                   #print result
                   print(add)
                   print(sub)
                   print(mul)
                   print(div)
                   print(div1)
                   print(mod)
                   print(power)




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

                      Output
                   13
                   5
                   36
                   2.25
                   2
                   1
                   6561







                   20     Touchpad MODULAR (Version 2.0)
   17   18   19   20   21   22   23   24   25   26   27