Computer Applications
int m,p; m=5; p=0; p= m-- + --m; The output will be:
- 11
- 10
- 8
- 12
Java Operators
20 Likes
Answer
8
Reason — Putting the values of variables in the expression:
Expression | Explanation |
---|---|
p = m-- + --m | This is the given expression. Initial value of m is 5. |
p = 5 + --m | At this step, current value of m (which is 5) is used in the expression and then value of m is decremented to 4. Current value of m becomes 4 after this step. |
p = 5 + 3 | --m first decrements the current value of m (which is 4) by 1 so m becomes 3. After that, this decremented value of 3 is used in the expression. |
p = 8 | This is the final result of the expression. |
Answered By
4 Likes
Related Questions
What will be the result of m in the expression m*=8 if m=8; ?
- 8
- 64
- 16
- 88
double c;
int x,y,z;
x=5; y=10; z=11;
c=x*y+z/2;
The value stored in c is:- 55.0
- 55.5
- 55
- none
int a=7, p=0, q=0;
p= ++a + --a;
q-=p;The output of q will be:
- 13
- 14
- 15
- -15
What will be the output of 'a' and 'b' in the expression b = a++, if int a, b; a=10?
- 10,10
- 10,11
- 11,10
- 11,11