Programming is nothing but one kinds of problem
solver, which can solve different type of problem by using legal logic .for
converting logic into program we use some operator.
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Increment and decrement operators
5. Assignment operator
2. Relational operators
3. Logical operators
4. Increment and decrement operators
5. Assignment operator
Arithmetic operators
Symbol
|
Name
|
Description
|
Example
|
+
|
Add
|
Adds
two operands
|
A
+ B
|
-
|
Subtracts
|
Subtracts
second operand from the first
|
A-B
|
*
|
Multiplies
|
Multiplies
both operands
|
A*B
|
/
|
Divides
|
Divides
numerator by de-numerator
|
A/B
|
%
|
Modulus
|
Modulus
Operator and remainder of after an integer division
|
A%B
|
Relational operators
Symbol
|
Name
|
Description
|
Example
|
==
|
Equal
|
Checks
if the values of two operands are equal or not, if yes then condition becomes
true.
|
A==B
|
!=
|
Not Equal
|
Checks
if the values of two operands are equal or not, if values are not equal then
condition becomes true.
|
A!=B
|
>
|
Greater
than
|
Checks
if the value of left operand is greater than the value of right operand, if
yes then condition becomes true.
|
A>B
|
<
|
Less
than
|
Checks
if the value of left operand is less than the value of right operand, if yes
then condition becomes true.
|
A<B
|
>=
|
Greater
than or equal
|
Checks
if the value of left operand is greater than or equal to the value of right
operand, if yes then condition becomes true.
|
A>=B
|
<=
|
Less
than or equal
|
Checks
if the value of left operand is less than or equal to the value of right
operand, if yes then condition becomes true.
|
A<=B
|
Logical operators
Symbol
|
Name
|
Description
|
Example
|
&&
|
And
|
Called
Logical AND operator. If both the operands are non-zero, then condition
becomes true.
|
A&&B
|
||
|
Or
|
Called
Logical OR Operator. If any of the two operands is non-zero, then condition
becomes true.
|
A||B
|
!
|
Nor
|
Called
Logical NOT Operator. Use to reverses the logical state of its operand. If a
condition is true, then Logical NOT operator will make false.
|
!(A&&B)
|
Increment and decrements operators
Symbol
|
Name
|
Description
|
Example
|
++
|
Increment
operator
|
Increases
integer value by one
|
A++
|
--
|
Decrements operator
|
Decreases
integer value by one
|
A--
|
Assignment operator
Symbol
|
Name
|
Description
|
Example
|
=
|
Assignment
|
Simple
assignment operator, Assigns values from right side operands to left side
operand
|
C
= A + B
|
+=
|
Assignment
|
Add
AND assignment operator, It adds right operand to the left operand and assign
the result to left operand
|
C
+= A
C
= C + A
|
-=
|
Subtraction Assignment
|
Subtract
AND assignment operator, It subtracts right operand from the left operand and
assign the result to left operand
|
C
-= A
C
= C - A
|
*=
|
Multiplication Assignment
|
Multiply
AND assignment operator, It multiplies right operand with the left operand
and assign the result to left operand
|
C
*= A
C
= C * A
|
/=
|
Division Assignment
|
Divide
AND assignment operator, It divides left operand with the right operand and
assign the result to left operand
|
C
/= A
C
= C / A
|
%=
|
Modulus Assignment
|
Modulus
AND assignment operator, It takes modulus using two operands and assign the
result to left operand
|
C
%= A
C
= C % A
|
<<=
|
Left shift assignment
|
Left
shift AND assignment operator
|
C
<<= 2
C
= C << 2
|
>>=
|
Right shift assignment
|
Right
shift AND assignment operator
|
C
>>= 2
C
= C >> 2
|
&=
|
Bit-wise exclusive And assignmen
|
Bit-wise AND
assignment operator
|
C
&= 2
C
= C & 2
|
^=
|
Bit-wise exclusive OR Assignment
|
Bit-wise exclusive
OR and assignment operator
|
C
^= 2
C
= C ^ 2
|
|=
|
Bit-wise inclusive OR Assignment
|
Bit-wise inclusive
OR and assignment operator
|
C
|= 2
C
= C | 2
|
Comments
Post a Comment