Page 27 - 6437
P. 27

--   Decrement       operator  decreases     the   integer   A--  =          9
                                     value by one.



                          Example
                          Try the following example to understand all the arithmetic operators available in C:
                          When you compile and execute the above program, it produces the following result:


                 #include <stdio.h>


                 main()
                 {

                    int a = 21;
                    int b = 10;

                    int c ;


                    c = a + b;
                    printf("Line 1 - Value of c is %d\n", c );

                    c = a - b;
                    printf("Line 2 - Value of c is %d\n", c );

                    c = a * b;
                    printf("Line 3 - Value of c is %d\n", c );

                    c = a / b;
                    printf("Line 4 - Value of c is %d\n", c );

                    c = a % b;
                    printf("Line 5 - Value of c is %d\n", c );

                    c = a++;
                    printf("Line 6 - Value of c is %d\n", c );

                    c = a--;
                    printf("Line 7 - Value of c is %d\n", c );


                 }

                            Line 1 - Value of c is 31







                                                                                                      29
   22   23   24   25   26   27   28   29   30   31   32