Assignment operators in C

Assignment operators-: Assignment operators are used to assign the result of an expression to a variable. We have seen the usual assignment operators “= “. C has a set of shorthand assignment operators of the form as like                    s op= exp ;

where s is a variable, exp is an expression and op is a c binary arithmetic operators op=OP.

assignment operators

  1. a=a+1
  2. a=a-1
  3. a=a*(n+1)
  4.  a=a/(n+1)
  5. a=a%n

The assignment has some advantage here

  1. What appears on the left hand side need not be repeated and therefore it becomes easier to writing.
  2. The statement is easy to read
  3. statement is more efficient

Example -:  We write a program here

#define  N  100                                                                                                             #define  A  2



int x;


while (x<N)






Output is





Leave a Reply

Your email address will not be published. Required fields are marked *