Computer Science, asked by FAIZREHAN, 10 months ago

How to convert compound assignment operators to normal expression

Answers

Answered by rishabhchouhan123
0

Answer:

Operator

Description

Examples

=

Assignment

The value of the expression on the right hand side of the equal sign is stored in the variable, subscript element, or range on the left side. The old value of the variable, if any, is discarded, and the value of the expression is stored in the variable. The expression on the right side can be of any type or structure.

Simple assignment examples:

A = 5

Assigns 5 to variable A:

B='Hello World'

Assign “Hello World” to variable B:

name = 'Mary'

The variable name becomes a scalar string variable.

arr = FLTARR(100)

Make arr a 100-element, floating-point array.

arr = arr[50:*]

Discard points 0 to 49 of arr. It is now a 50-element array.

op=

Compound Assignment

where op is one of the following operators: ##, #, *, +, -, /, <, >, ^, AND, EQ, GE, GT, LE, LT, MOD, NE, OR, XOR

Provides succinct syntax for expressions in which the same variable would otherwise be present on both sides of the equal sign.

See Compound Assignment Operators for details.

Applies the specified operation to the target variable “in place,” without making a copy of the variable. For example,

A += 5

adds 5 to the value of the variable A.

A op= expression

is equivalent to:

A = TEMPORARY(A) op (expression)

The following statements both add 100 to current value of A:

A = A + 100

A += 100

Explanation:

hope it help

Answered by rambabuemailid
0

Answer:

Compound-assignment operators provide a shorter syntax for assigning the result of an arithmetic or bitwise operator. They perform the operation on the two operands before assigning the result to the first operand.

The following are all possible assignment operator in java:

1. += (compound addition assignment operator) 2. -= (compound subtraction assignment operator) 3. *= (compound multiplication assignment operator) 4. /= (compound division assignment operator) 5. %= (compound modulo assignment operator) 6. &= (compound Bitwise & assignment operator) 7. |= (compound Bitwise | assignment operator) 8. ^= (compound Bitwise ^ assignment operator) 9. >>= (compound right-shift assignment operator) 10. >>>=(compound right-shift filled 0 assignment operator) 11. <<=(compound left-shift assignment operator)

Similar questions