+ 1
How to explain ds. int x = 1; int y, result; y = x; x++; result = y + x; result += x;
Programming
3 Antworten
+ 3
+ 1
It's simple
Here x = 1 declared
So y = 1 also Because y = x here we are assigning the value of x to y.
Next line is x++;
So here x will increase and the value of x will be 2
So now x = 2;
Next line is result = y + x
So result will be 1 + 2 = 3
Now next line result += x; it means result = result + x;
So result will be 3 + 2 = 5;
+ 1
Sarthak 🇳🇵 👍👍👍