what is operator?
Operators are a special symbol or keyword used to perform on variable or value. They are the foundation of expression and used for tasks like arithmetic, ****comparison ,assignment and more.
what is operand?
An operand is a value or variable on which an operator acts.
example:
int a=6;
int b=7;
int sum=a+b;
The operator + perform addition on operands a & b.
Types of operators:
Arithmetic operators-used to perform on basic mathematical operations.
They are,
- ->addition.It can be represent by a+b.
- ->subtraction.It can be represent by a-b.
- ->multiplication.It can be represent by a*b. / ->division.It can be represent by a/b. % ->module(remainder).It can be represent by a%b.
Relational operator-used to compare two values.
== ->equal to.It can be represent by a==b.
!= ->not equal to.It can be represent by a!=b.
->greater then.It can be represent by a>b.
< ->less then.It can be represent by a = ->greater then or equal to.It can be represent by a>=b.
<= ->less then or equal to.It can be represent by a<=b.
Logical operator-used to combine multiple boolean operator.They are,
&& ->logical and.It can be represent by (a>b && b>0).
|| ->logical or.It can be represent by (a<b || b<0).
unary operator-used for increment and decrement.
++ ->there are post and prefix increment.++x or x++.
-- ->there are post and prefic decrement.--x or x--.
Top comments (0)