6. If a = 5, b =9, calculate the value of:
a += a++ - ++b + a
7. If x= 3. y = 7, calculate the value of
x = x++-++y
8. What will be the output of the following if x=5?
5*++*
5*x++
please give solution of these questions
Answers
Answer:
6) if a = 5 and b = 9
a+= a++ - ++b +a
=> 5 += 5++ - ++9 +5
=> 5+= ( 5 + 1 ) - ( 9 + 1) + 5
=> 5 += 6 - 10 + 5
=> 5+= 4 + 9
=> 5+= 13
=> 13 + 5
=> 18 (ans)
----------------END-----------------
7) if x = 3 and y = 7
x = x++ - ++y
=> 3 = ( 3 + 1 ) - ( 7 + 1 )
=> 3 = 4 - 8
=> 3 = 4 (ans)
------------ END --------------
8) if x = 5
5*++*
=> 5 * 1 + 1 * 1
=> 5 + 6 * 1
=> 11 * 1
=> 12
----------------END of first equation----------------
5*x++
=> 5 * 5++
=> 25++
=> 26
--------------------- ANSWER ENDS HERE ------------------------
HOPE YOU LIKE IT..
THEN PLEASE MAKE ME BRAINLIST OR FOLLOW ME..
Explanation:
Answer:
Explanation:
x = x++ + ++y; (1)
y = ++x + ++y; (2)
In (1) this is the following operations to be done.
i) ++y
ii) x = x+y
iii) x ++
In (2) this is the following operations to be done.
i) x ++
ii) y++
iii) y = x + y
- Psycho 7 years ago | Flag Reply
0
of 0 votes
i have a doubt .
the precedence of increment operator is higer than +,*,/ ,then before performing addition,The postfix and prefix operation is performed then then arithmetic operation.
in both cases i think the operations to be done are
i)++x
ii)y++
iii)y=x+y