BulldogLowell:
c = a + b;try
c += (a + b);
Sorry, That didn't work.
DrAzzy:
It's doing exactly what you're telling it to - which is something different from what you want.Do it out by hand (this is what you should always do when you run into an issue like this):
a=10
b=1
c=0First round:
b=b+1 (1+1=2 - b is now 2)
c=a+b (10+2=12 - c is now 12)Second round:
b=b+1 (2+1=3 - b is now 3)
c=a+b (10+3 = 13 - c is now 13)and so on.
I forgot to mention
B does not increase, It stays at 1
so the output is this:
10
11
12
13
14
15
16
17
18
19
20
etc