Page 98 - Computer Genius Class 06
P. 98

Operator         Symbol                Description                        Example


                   Simple assignment        =      Assigns value to the left operand    c = a + b (c = 10 + 30)
                   operator                        from right operand                   will assign the value of c to
                                                                                        a + b (c = 40)

                   Add AND                 +=      Adds the right operand to the left  b + = a (b + = 10) is
                   assignment                      operand and assign the result to     equivalent to b = b + a (b =
                   operator                        the left operand                     30 + 10) (b = 40)

                   Subtract AND             -=     Subtracts the right operand from     b – = a (b– = 10) is
                   assignment                      the left operand and assigns the     equivalent to b = b – a
                   operator                        result to the left operand           (b=30-10) (b=20)

                   Multiply AND            *=      Multiplies the right operand with    b *= a (b *= 10) is equivalent
                   assignment                      the left operand and assigns the     to b = b * a
                   operator                        result to the left operand           (b = 30 * 10) (b=300)


                   Divide AND              /=      Divides the left operand with the    b /= a (b/ = 10) is equivalent
                   assignment                      right operand and assigns the        to b = b / a
                   operator                        result to the left operand.          (b = 30/10) (b=3)

                   Modulus AND             %=      Takes modulus of two operands        b % = a (b% = 10) is
                   assignment                      and assigns the result to the left   equivalent to b = b % a
                   operator                        operand                              (b = 30 % 10) (b=0)


                  What is Variable Initialization?

                  To use  aria les in programming  first  e need to create the  aria les and assign them a re erence
                  in the computer memory.

                  Variable is a storage area which the programs can manipulate by changing the values stored in it.





























                       96    Computer Genius-VI
   93   94   95   96   97   98   99   100   101   102   103