What is Operators and Expressions?
An operator is a symbol which helps the user to command the computer. We can do a certain mathematical or logical manipulation. To operate data and variable, we can use Operators.
There are many Operators are as follows:
Arithmetic Operators: This operators are +, -, *, /, %.
+: If we want to add two variable, we will + operator. For Example: A+B.
-: If we want to subtract two variable then we will use – operator. For Example, A-B.
* : If we want to multiply two variable then we will use * operator. For Example, A*B.
/ : If we want to divide to variable, we will use / operator. For Example, A/B.
Relational Operator: Relational operators are used to compare two variable.
< , > : To predict which variable is smaller and which variable is larger, we can use < , > operators. For Example, A>B or A<B.
<= , >= : it shows the variable is less than or equal to and greater than or equal to Respectively. For example, A>=B, A<=B.
== : When two variables are equal. For example, A==B.
!= : When two variables are not equal. For example, A!=B.
Logical Operator: Logical Operators contains AND, OR and NOT operators.
&&(AND) : When one variable contains two value. For example, ch>=65 && ch<=90.
| | (OR) : When one variable can have only one value either first or second. For example, ch>=65 | | ch<=90.
! (NOT) : When value of variable is not acceptable.
Assignment operator: It contains only = operator. Evaluate an expression and assign it to the left hand side variable. For example, A= 100.
Bitwise Operators: It contains &, |, ^, << and >> operators.
& :For example,6 & 3 = 2.
| : For example, 10 | 10 = 10
^ : For example, 2^2=0
<< : For example, 10<<2 =40
>> : For example, 10>> 2 = 2
Expressions: An expression is a combination of variables constant and operators. For Example, a*b-c.