Assignment operators in C Language with examples

Assignment operators in C





An assignment operator is the operator used to assign a new value to a variable, property, event or indexer element in C# programming language. Assignment operators can also be used for logical operations such as bitwise logical operations or operations on integral Operands and boolean operands.





  1. #include <stdio.h>
  2. int main() {
  3.       int a, b, c, d, e;  // variable declaration
  4.       a = b = c = d = e = 100;  // assign 100 to a, b, c, d & e
  5.  
  6.       a += 10; // a = a + 10
  7.       printf("Value of a is %d\n", a);
  8.  
  9.       b -= 10; // b = b - 10
  10.       printf("Value of b is %d\n", b);
  11.  
  12.       c *= 10; // c = c * 10
  13.       printf("Value of c is %d\n", c);
  14.  
  15.       d /= 10; // d = d / 10
  16.       printf("Value of d is %d\n", d);
  17.  
  18.       e %= 10; // e = e % 10
  19.       printf("Value of e is %d\n", e);
  20.       return 0;
  21. }



 OUTPUT

Comments

Popular posts from this blog

Implement Bouncing Ball Animation Using C Graphics

Walking Stickman -Using C graphics

Sine Wave - Using C Graphics