If x= 6 initially what will be the result/output of the
following two expressions?
(i) 10 * + + x;
(ii) X ++ * 10;
Answers
Answered by
2
ANSWER
(a) 5* ++x;
30
WORKING
5* ++x
⇒ 5* 6 [∵ ++x will first increment x to 6 and then use it in the expression]
⇒ 30
(b) 5* x++;
25
WORKING
5* x++
⇒ 5* 5 [∵ x++ will first use the current value of x in the expression which is 5. After that x is incremented to 6]
⇒ 25
Answered by
5
Answer with Explaination:-
Given, x=6
Output of:-
- 10 * ++x
10 * ++x
here ++x is prefix increment operator so x will first increase the value
10 * ++6
10 * 7
70
- x++ * 10
Now here, it is x++ and x++ is postfix increment operator
Therefore, it will first calculate then increase its value
6 * 10
60
Similar questions