Page 102 - Computer Genius Class 07
P. 102

2. Subtraction

                  Subtraction operation is used to perform mathematical subtraction of two variables. In programming,
                  we refer to “-” as a symbol of subtraction. Please note that subtraction can only be carried out on
                  Integer, Float, Double data types.

                  Example:                    print (10–5)            5


                  3. Multiplication

                   ultiplication operator  is used to find the mathematical product o  t o  aria les.  n programming
                  we refer to ‘*’ as a symbol of multiplication. Please note that multiplication can only be carried out
                  on Integer, Float and Double data types.

                  Example:                    print (10*5)            50


                  4. Division
                  Division operator  is used to perform the mathematical division of two variables. In programming,
                  we refer to ‘/’ as a symbol of division. Please note that Division can only be carried out on Integer,
                  Float and Double data types.

                  Example:                    print (10/5)            2


                  5. Modulus
                  Modulus operator  is used to perform the mathematical remainder of two variables. In programming,
                  we refer to ‘%’ as a symbol of modulus. The operator divides the variable on the left to the variable
                  on right and returns the remainder. Please note that modulus can only be carried out on integer and
                   oat data types in  ython.

                  Example:                    print (10%5)            0
                  Total Distance Covered by a Vehicle

                  To create an A   onnect program to find the total distance  create a pro ect.  n this pro ect create
                  a  asic  oding acti ity. Then  ollo  the gi en steps

                    ere  the speed o  the  ehicle is     m hrs and time ta en to co er  ourney is 12  minutes to find
                  the total distance covered in Km. We can change the values in this program).
                  (Hint: Convert minutes into hours).
                   Step 1    rint the in ormation  or the readers and define a  aria le  speed   and set its  alue to   .


                              Block Code












                      100    Computer Genius-VII
   97   98   99   100   101   102   103   104   105   106   107