C program to demonstrate the working of assignment operators
//C program to demonstrate the working of assignment operators:-
#include<stdio.h>
#include<conio.h>
void
main()
{
int a=15;
clrscr();
printf("A=15:\n");
a+=5;
printf("A+=5 = %d \n",a); //Now a is 20
a-=5;
printf("A-=5 = %d \n",a); //Now a is 15
a/=5;
printf("A/=5 = %d \n",a); //Now a is 3
a*=5;
printf("A*=5 = %d \n",a); //Now a is 15
a%=5;
printf("A Modulus=5 = %d \n",a); //Now a is 0
getch();
}
===============
OUTPUT:-
A=15:
A+=5
= 20
A-=5
= 15
A/=5
= 3
A*=5
= 15
A
Modulus=5 = 0
===============
Comments
Post a Comment