0
How to assign/swap a sum to a variable in a loop?
If I add two numbers (let's say x + y) and want to make the sum of that the new x so that the result becomes the x in each iteration of the loop, how can I do that? I assign x = 1 at the beginning for starting off, how do I replace that with the sum of x + y?
3 Respuestas
+ 1
x = x + y
Or
x += y
+ 1
for(int i = 0; i < y; ++i)
x++;
0
Thank you! Problem solved :)