Assignment Operators:-
The following are the assignment operators being used in these languages:-
These operators can be used in C languages family as:-
#include<stdio.h>
void main()
{
int x;
int a;
x=4;
a=5;
printf("%d is the value of X:",x);
x+=5; //means x=x+5;
printf("%d is the value of X after x+=5; operation:",x);
x-=5; //means x=x-5;
printf("%d is the value of X after x-=5; operation:",x);
x*=5; //means x=x*5;
printf("%d is the value of X after x*=5; operation:",x);
x/=5; //means x=x/5;
printf("%d is the value of X after x/=5; operation:",x);
x%=5; //means x=x%5;
printf("%d is the value of X after x%=5; operation:",x);
}
The following are the assignment operators being used in these languages:-
- Equality Assignment Operator(=)
- Addition and Equality Assignment Operator(+=)
- Subtraction and Equality Assignment Operator(-=)
- Multiply and Equality Assignment Operator(*=)
- Divide and Equality Assignment Operator(/=)
- Modulus and Equality Assignment Operator(%=)
These operators can be used in C languages family as:-
#include<stdio.h>
void main()
{
int x;
int a;
x=4;
a=5;
printf("%d is the value of X:",x);
x+=5; //means x=x+5;
printf("%d is the value of X after x+=5; operation:",x);
x-=5; //means x=x-5;
printf("%d is the value of X after x-=5; operation:",x);
x*=5; //means x=x*5;
printf("%d is the value of X after x*=5; operation:",x);
x/=5; //means x=x/5;
printf("%d is the value of X after x/=5; operation:",x);
x%=5; //means x=x%5;
printf("%d is the value of X after x%=5; operation:",x);
}
No comments:
Post a Comment