Page 62 - Trackpad_ipro 4.1_Class8
P. 62

Example
                      Operator                  Description                Syntax                           Output
                                                                                      (int a = 11, b = 4)

                          *          Returns the result after performing     a * b           a * b              44
                   (multiplication) multiplication

                           /         Returns the result after performing     a / b           a / b              2
                      (division)     division

                          %          Returns the remainder  after           a % b            a % b              3
                      (modulus)      performing division


                  Relational Operators

                  Relational operators help compare quantities and return the Boolean value ‘True’ or ‘False’ as
                  a result. These are also known as comparison operators.


                                                                                          Example
                     Operator                  Description                Syntax                            Output
                                                                                     (int a = 11, b = 4)

                   == (equal to) To  check  equality  between  two  (a == b)        a == b                 false
                                   values                                           a == 11                true

                         !=        To check inequality between two  (a != b)        a != b                 true
                   (not equal to) values                                            a != 11                false


                         >         To check if the first value is greater  (a > b)  (a > b)                true
                   (greater than) than the second value                             (11 > 13)              false

                         <         To check if the first value is lesser  (a < b)   (a < b)                false
                     (less than)   than the second value                            (15 < 20)              true


                         >=        To check if the first value is greater  (a >= b)  (a >= b)              true
                   (greater than  than or equal to the second value                 (22 >= 19)             true
                    or equal to)
                                                                                    (21 >= 23)             false

                         <=        To check if the first value is lesser  (a <= b)  a <=b                  false
                    (less than or  than or equal to the second value                (27 <= 26)             false
                     equal to)
                                                                                    (30 <= 31)             true

                  Logical Operators


                  Logical operators are used to combine multiple conditions and evaluate them. They return a
                  Boolean value ‘True’ or ‘False’ as result.







                    60     iPro (Ver. 4.1)-VIII
   57   58   59   60   61   62   63   64   65   66   67