Int var =2
Var =4
Var=var +6
Var =var +var
Answers
Answered by
2
Answer:
20 should be the value of "var" if that's hat you wanted
Answered by
0
Given the code snippet,
- int var = 2;
- var = 4;
- var = var + 6;
- var = var + var;
- Here, we can see that the value of the variable "var" is being reassigned multiple times.
- After the first assignment "var = 2", the value of "var" becomes 2.
- In the next assignment "var = 4", the value of "var" becomes 4.
- In the third assignment "var = var + 6", the value of "var" becomes 4 + 6 = 10.
- In the final assignment "var = var + var", the value of "var" becomes 10 + 10 = 20.
- So, after executing all the assignments, the final value of the variable "var" is 20.
#SPJ3
Similar questions