a program demonstrates assignment operator in C



#include
void main()
{
int x = 10;

/* demonstrate = operator */
int y = x;
printf("y = %d\n",y);

/* demonstrate += operator */
y += 10;
printf("y += 10;y = %d\n",y);
/* demonstrate -= operator */
y -=5;
printf("y -=5;y = %d\n",y);

/* demonstrate *= operator */
y *=4;
printf("y *=4;y = %d\n",y);

/* demonstrate /= operator */
y /=2;
printf("y /=2;y = %d\n",y);

}

No comments:

Post a Comment