Sunday, 15 October 2017

Assignment & Relational operators

2) Assignment operator: assignment operator is used  to assign a values to a  variable. the left side of the assignment operator is a variable.the right side of the assignment operator is a value.
There are different types of assignment operators:


OPERATORS
DESCRIPTION
EXAMPLE
=    (Assignment)
It assigns a values from right side operands to left side operand
x=y
+=  (Addition assignment)
It will adds right operand to left operand and assign the result to left
x += y  is similar as x=x+y
-=  (subtraction assignment)
It will subtract the right operand from the left operand and it will assigns the result to left operand
x -= y is similar as x=x-y
*= (multiplication assignment)
It will multiply left operand with the right operand and assign the result to left operand
x*=y is similar as x=x*y
/= (division assignment)
It will divides left operand with the right operand and assign the result to left operand
x/=y is similar as x=x/y
%= (remainder assignment)
It will calculates the modulus using two operands  and it will assign the result to left operand
x%=y is similar as x=x%y


3) Relational operator: The Relational operators are used for comparison of the values of two operands. if one operand is equal to the other operand or not.There are some relational operators are
(== , > , < , <= , >=, !=)


                            Operator
          Meaning
 >
Greater than
< 
Lesser than
>=
Greater than or equal to
<=
Lesser than or equal to
==
Equal to
!=
Not equal

No comments:

Post a Comment

OPERATERS

"Don't Review Skip": Fans Troll Tim Paine For Poor DRS Challenge On Day 3

India vs Australia: Tim Paine was again in the firing line as his poor DRS call against Mayank Agarwal cost Australia a review on Day 3 of t...