what will be the value of x if a=6, b=8? x = a++ + --a + b++ + a++ + a +--b
Answers
Answered by
0
Answer:
12
Explanation:
20-8.. hy aahy uza answer
Answered by
1
Given:
The values of and are and .
To find:
We need to find the value of , where .
Solution:
Before solving this question, we need to revise some concepts related to increment and decrement.
- Pre - increment : In this type of increment, before assigning the value to the variable, the value is incremented by one.
- Post - increment : In this type of increment, after assigning the value to the variable, the value is incremented by one.
- Pre - decrement : In this type of decrement, before assigning the value to the variable, the value is decremented by one.
- Post - decrement : In this type of decrement, after assigning the value to the variable, the value is decremented by one.
Now, consider the given expression, let that equation be (i),
....... (i)
We will solve the above equation part by part.
1. Consider ,
- This is post - increment case.
- So, assign the value to the variable and then increment the by one.
- So, .
- Now the value of is .
2. Now consider ,
- This is pre - decrement case.
- So, before assigning the value to the variable, the value of is decremented by one.
- Now the value of is .
- So, .
3. Consider ,
- This is post - increment case.
- So, assign the value to the variable and then increment the by one.
- So, .
- Now the value of is .
4. Consider ,
- This is post - increment case.
- So, assign the value to the variable and then increment the by one.
- So, .
- Now the value of is .
5. Consider ,
- The value of is .
6. Now consider ,
- This is pre - decrement case.
- So, before assigning the value to the variable, the value of is decremented by one.
- Now the value of is .
- So, .
Now, substitute all these values in equation (i).
Therefore, the value of is .
Similar questions